CMakeDetermineCompilerABI: Link with standard libraries on MSVC
In commit v2.8.0~395 (Implicit link info for C, CXX, and Fortran, 2009-07-23) we added a '-DCMAKE_${lang}_STANDARD_LIBRARIES=' flag to the try_compile used to build the ABI detection project. It is needed when detecting the implicit libraries added by the GNU compiler on Windows (MinGW tools) to avoid contaminating the list with standard Windows libraries. However, with MSVC we do not detect such implicit link libraries anyway, and for some target platforms (e.g. Windows Phone) we may need the standard libraries to link the ABI detection executable. Drop the flag when detecting the ABI using MSVC.
This commit is contained in:
parent
f7ab238379
commit
03ad8f28c8
|
@ -28,13 +28,15 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
|
|||
if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
|
||||
set(CMAKE_FLAGS "-DCMAKE_EXE_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
|
||||
# from which we might detect implicit link libraries.
|
||||
list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=")
|
||||
endif()
|
||||
try_compile(CMAKE_${lang}_ABI_COMPILED
|
||||
${CMAKE_BINARY_DIR} ${src}
|
||||
CMAKE_FLAGS "${CMAKE_FLAGS}"
|
||||
"-DCMAKE_${lang}_STANDARD_LIBRARIES="
|
||||
# We need ignore these warnings because some platforms need
|
||||
# CMAKE_${lang}_STANDARD_LIBRARIES to link properly and we
|
||||
# don't care when we are just determining the ABI.
|
||||
CMAKE_FLAGS ${CMAKE_FLAGS}
|
||||
# Ignore unused flags when we are just determining the ABI.
|
||||
"--no-warn-unused-cli"
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
COPY_FILE "${BIN}"
|
||||
|
|
Loading…
Reference in New Issue