Forráskód Böngészése

CMakeDetermineCompilerABI: Use normal linker flags in ABI project

When compiling the ABI detection test project, do not override
CMAKE_EXE_LINKER_FLAGS completely.  The normally selected value of this
variable may influence how the link is done and may be needed to be
representative of how the calling project will be built.  Instead pass a
variable that try_compile will reference as additional flags.  Leave
this behavior of try_compile undocumented for now.
Brad King 11 éve
szülő
commit
a4f9b6f0ca

+ 1 - 1
Modules/CMakeDetermineCompilerABI.cmake

@@ -26,7 +26,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
     set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin")
     set(CMAKE_FLAGS )
     if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
-      set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
+      set(CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
     endif()
     if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC")
       # Avoid adding our own platform standard libraries for compilers

+ 2 - 0
Source/cmCoreTryCompile.cxx

@@ -331,6 +331,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
               " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str());
       }
+    fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS}"
+            " ${EXE_LINKER_FLAGS}\")\n");
     fprintf(fout, "include_directories(${INCLUDE_DIRECTORIES})\n");
     fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n");
     fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n");