i've tried to add PROFILE
to the CMAKE_BUILD_TYPES
. For this I need to add -finstrument-functions
to the CMAKE_CXX_FLAGS
in the toolchain file and link the belonging library with the absolut path in the CMakeLists.txt via target_link_libraries
. So far so good and unproblematic.
But when refreshing the buildinformations cmake checks if the compiler stil does it's job. And now "is not able to compile a simple test program", due to the lack of the needed library, which is linked later in the CMakeLists.
So I commented the -finstrument-functions
flag and the testprogramm could be compiled.
I've tried to: - Set librarie and path as a part of the CXX flags with -L -l:
Use the
link_directories(<dir>)
command as well asSET(CMAKE_LINK_DIRECTORIES_BEFORE <Path> )
andSET(CMAKE_LIBRARY_PATH <Path>)
Set variables in the toolchainfile and call them later in the cmakelists:
SET(ADDITIONAL_PROFILE_LIBRARY "$ENV{QNX_BASE}/target/qnx7/armle-v7/usr/liblibprofilingS.a")
SET(ADDITIONAL_PROFILE_FLAGS "-finstrument-functions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" "${ADDITIONAL_PROFILE_FLAGS}")
add_executable(toolchainTester main.cpp)
target_link_libraries(toolchainTester ${ADDITIONAL_PROFILE_LIBRARY})
But then getting the error: mingw32-make.exe[3]: *** No rule to make target 'C:/qnx700/target/qnx7/armle-v7/usr/liblibprofilingS.a', needed by '../out/profileout'. Stop.
Got anyone any more ideas? Thanks in advance.
If there anyone out there, looking for the same workaround how to manage different flags and libraries for different profiles, this is one working way:
First set variables in the toolchainfile
The call/overright them in the CMakeLists.txt