Hi, I need to build a project with a weird set of compile/link flags: CFLAGS = -fsanitize=memory LINKFLAGS for executables = -fsanitize=memory -pie LINKFLAGS for shared libraries = -fsanitize=memory
The trick is, linker flags have to be exactly this way: -pie can not be omitted for executables (the other flag requires -pie, link will fail without it), and, of course, it can not be specified for shared libraries. I configure the project with -DCMAKE_C_FLAGS=-fsanitize=memory -DCMAKE_EXE_LINKER_FLAGS=-pie and get a failure in the compiler test: [2/2] Linking C executable cmTryCompileExec3346801198 ... clang-3: error: invalid argument '-fsanitize=memory' only allowed with '-pie' Apparently, linking of the compiler test binary is done with CMAKE_C_FLAGS, but without CMAKE_EXE_LINKER_FLAGS. Is it true? Why? Am I missing something? Any workarounds? Sorry if this is a duplicate message, it did not make it to the list on the first try. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
