diff options
Diffstat (limited to 'Modules/Platform')
-rw-r--r-- | Modules/Platform/Darwin-AppleClang-C.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/Darwin-AppleClang-CXX.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/Darwin-icc.cmake | 6 | ||||
-rw-r--r-- | Modules/Platform/Darwin.cmake | 14 | ||||
-rw-r--r-- | Modules/Platform/Haiku.cmake | 127 | ||||
-rw-r--r-- | Modules/Platform/Linux-Intel-Fortran.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/MirBSD.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/QNX.cmake | 6 | ||||
-rw-r--r-- | Modules/Platform/UnixPaths.cmake | 15 | ||||
-rw-r--r-- | Modules/Platform/Windows-Clang-C.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/Windows-Clang-CXX.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/Windows-Clang.cmake | 32 | ||||
-rw-r--r-- | Modules/Platform/Windows-Intel-CXX.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/Windows-Intel.cmake | 93 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC-C.cmake | 3 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC-CXX.cmake | 3 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 25 | ||||
-rw-r--r-- | Modules/Platform/WindowsPaths.cmake | 29 |
18 files changed, 233 insertions, 132 deletions
diff --git a/Modules/Platform/Darwin-AppleClang-C.cmake b/Modules/Platform/Darwin-AppleClang-C.cmake new file mode 100644 index 0000000..98971bb --- /dev/null +++ b/Modules/Platform/Darwin-AppleClang-C.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-Clang-C) diff --git a/Modules/Platform/Darwin-AppleClang-CXX.cmake b/Modules/Platform/Darwin-AppleClang-CXX.cmake new file mode 100644 index 0000000..4e9e7c1 --- /dev/null +++ b/Modules/Platform/Darwin-AppleClang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-Clang-CXX) diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake index 6a46f8e..0fab9a1 100644 --- a/Modules/Platform/Darwin-icc.cmake +++ b/Modules/Platform/Darwin-icc.cmake @@ -60,12 +60,6 @@ if(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) CACHE STRING "Build architectures for OSX") endif() - -if("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") - set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS - "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress") -endif() - if(NOT XCODE) # Enable shared library versioning. This flag is not actually referenced # but the fact that the setting exists will cause the generators to support diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 72844b5..fc3f87e 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -223,11 +223,6 @@ if(CMAKE_OSX_DEPLOYMENT_TARGET) endif() endif() -if("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") - set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS - "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress") -endif() - # Enable shared library versioning. set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") @@ -268,6 +263,11 @@ set(CMAKE_C_CREATE_MACOSX_FRAMEWORK set(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>") +# Set default framework search path flag for languages known to use a +# preprocessor that may find headers in frameworks. +set(CMAKE_C_FRAMEWORK_SEARCH_FLAG -F) +set(CMAKE_CXX_FRAMEWORK_SEARCH_FLAG -F) +set(CMAKE_Fortran_FRAMEWORK_SEARCH_FLAG -F) # default to searching for frameworks first if(NOT DEFINED CMAKE_FIND_FRAMEWORK) @@ -341,7 +341,9 @@ foreach(_path list(APPEND _apps_paths "${_apps}") endif() endforeach() -list(REMOVE_DUPLICATES _apps_paths) +if(_apps_paths) + list(REMOVE_DUPLICATES _apps_paths) +endif() set(CMAKE_SYSTEM_APPBUNDLE_PATH ${_apps_paths}) unset(_apps_paths) diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake index 8987783..825f851 100644 --- a/Modules/Platform/Haiku.cmake +++ b/Modules/Platform/Haiku.cmake @@ -1,22 +1,123 @@ -set(BEOS 1) +# process only once +if(HAIKU) + return() +endif() + +set(HAIKU 1) +set(UNIX 1) -set(CMAKE_DL_LIBS root be) -set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") -set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_DL_LIBS "") set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") -set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + +# Determine, if the C or C++ compiler is configured for a secondary +# architecture. If so, that will change the search paths we set below. We check +# whether the compiler's library search paths contain a +# "/boot/system/develop/lib/<subdir>/", which we assume to be the secondary +# architecture specific subdirectory and extract the name of the architecture +# accordingly. +set(__HAIKU_COMPILER ${CMAKE_C_COMPILER}) + +if(NOT __HAIKU_COMPILER) + set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER}) +endif() + +execute_process( + COMMAND ${__HAIKU_COMPILER} -print-search-dirs + OUTPUT_VARIABLE _HAIKU_SEARCH_DIRS + OUTPUT_STRIP_TRAILING_WHITESPACE) + +string(REGEX MATCH ".*\nlibraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/(:[^\n]*)?\n.*" _dummy "\n${_HAIKU_SEARCH_DIRS}\n") +set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}") + +if(NOT CMAKE_HAIKU_SECONDARY_ARCH) + set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "") + unset(CMAKE_HAIKU_SECONDARY_ARCH) +else() + set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "/${CMAKE_HAIKU_SECONDARY_ARCH}") + + # Override CMAKE_*LIBRARY_ARCHITECTURE. This will cause FIND_LIBRARY to search + # the libraries in the correct subdirectory first. It still isn't completely + # correct, since the parent directories shouldn't be searched at all. The + # primary architecture library might still be found, if there isn't one + # installed for the secondary architecture or it is installed in a less + # specific location. + set(CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH}) + set(CMAKE_C_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH}) + set(CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH}) +endif() + +list(APPEND CMAKE_SYSTEM_PREFIX_PATH + /boot/common/non-packaged + /boot/common + /boot/system + ) + +LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES + /boot/common/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + /boot/common/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + /boot/system/develop/headers/os + /boot/system/develop/headers/os/app + /boot/system/develop/headers/os/device + /boot/system/develop/headers/os/drivers + /boot/system/develop/headers/os/game + /boot/system/develop/headers/os/interface + /boot/system/develop/headers/os/kernel + /boot/system/develop/headers/os/locale + /boot/system/develop/headers/os/mail + /boot/system/develop/headers/os/media + /boot/system/develop/headers/os/midi + /boot/system/develop/headers/os/midi2 + /boot/system/develop/headers/os/net + /boot/system/develop/headers/os/opengl + /boot/system/develop/headers/os/storage + /boot/system/develop/headers/os/support + /boot/system/develop/headers/os/translation + /boot/system/develop/headers/os/add-ons/graphics + /boot/system/develop/headers/os/add-ons/input_server + /boot/system/develop/headers/os/add-ons/screen_saver + /boot/system/develop/headers/os/add-ons/tracker + /boot/system/develop/headers/os/be_apps/Deskbar + /boot/system/develop/headers/os/be_apps/NetPositive + /boot/system/develop/headers/os/be_apps/Tracker + /boot/system/develop/headers/3rdparty + /boot/system/develop/headers/bsd + /boot/system/develop/headers/glibc + /boot/system/develop/headers/gnu + /boot/system/develop/headers/posix + /boot/system/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + ) +IF (CMAKE_HAIKU_SECONDARY_ARCH) + LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES + /boot/system/develop/headers + ) +ENDIF (CMAKE_HAIKU_SECONDARY_ARCH) + +LIST(APPEND CMAKE_HAIKU_C_INCLUDE_DIRECTORIES + ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES} + ) + +LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES + ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES}) + +LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES}) + +LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES + /boot/common/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + /boot/common/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + /boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + ) + +LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES} + ) -include(Platform/UnixPaths) -list(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common) -list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/common/include) -list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/common/lib) -list(APPEND CMAKE_SYSTEM_PROGRAM_PATH /boot/common/bin) -list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /boot/common/lib) -list(APPEND CMAKE_SYSTEM_INCLUDE_PATH /boot/develop/headers/3rdparty) -list(APPEND CMAKE_SYSTEM_LIBRARY_PATH /boot/develop/lib/x86) +LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES}) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake index bb671ee..0c9523c 100644 --- a/Modules/Platform/Linux-Intel-Fortran.cmake +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -1,4 +1,4 @@ include(Platform/Linux-Intel) __linux_compiler_intel(Fortran) -set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -i_dynamic -nofor_main") -set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic") +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -nofor_main") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") diff --git a/Modules/Platform/MirBSD.cmake b/Modules/Platform/MirBSD.cmake new file mode 100644 index 0000000..7637f9b --- /dev/null +++ b/Modules/Platform/MirBSD.cmake @@ -0,0 +1 @@ +include(Platform/OpenBSD) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index 2598411..9afde05 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -3,6 +3,9 @@ set(QNXNTO 1) # The QNX GCC does not seem to have -isystem so remove the flag. set(CMAKE_INCLUDE_SYSTEM_FLAG_C) set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) +# ... Nor does the driver support appropriate flags to create depfiles. +set(CMAKE_DEPFILE_FLAGS_C) +set(CMAKE_DEPFILE_FLAGS_CXX) set(CMAKE_DL_LIBS "") set(CMAKE_SHARED_LIBRARY_C_FLAGS "") @@ -13,6 +16,9 @@ set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") +# http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples +set(CMAKE_C_COMPILE_OPTIONS_TARGET "-V") +set(CMAKE_CXX_COMPILE_OPTIONS_TARGET "-V") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index ccb2663..eca3280 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -37,10 +37,19 @@ list(APPEND CMAKE_SYSTEM_PREFIX_PATH # CMake install location "${_CMAKE_INSTALL_DIR}" - - # Project install destination. - "${CMAKE_INSTALL_PREFIX}" ) +if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # Project install destination. + "${CMAKE_INSTALL_PREFIX}" + ) + if(CMAKE_STAGING_PREFIX) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # User-supplied staging prefix. + "${CMAKE_STAGING_PREFIX}" + ) + endif() +endif() # List common include file locations not under the common prefixes. list(APPEND CMAKE_SYSTEM_INCLUDE_PATH diff --git a/Modules/Platform/Windows-Clang-C.cmake b/Modules/Platform/Windows-Clang-C.cmake new file mode 100644 index 0000000..d007105 --- /dev/null +++ b/Modules/Platform/Windows-Clang-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Clang) +__windows_compiler_clang(C) diff --git a/Modules/Platform/Windows-Clang-CXX.cmake b/Modules/Platform/Windows-Clang-CXX.cmake new file mode 100644 index 0000000..2c3688a --- /dev/null +++ b/Modules/Platform/Windows-Clang-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Clang) +__windows_compiler_clang(CXX) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake new file mode 100644 index 0000000..4c936fe --- /dev/null +++ b/Modules/Platform/Windows-Clang.cmake @@ -0,0 +1,32 @@ + +#============================================================================= +# Copyright 2001-2013 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_CLANG) + return() +endif() +set(__WINDOWS_CLANG 1) + +if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC" + OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + include(Platform/Windows-MSVC) + macro(__windows_compiler_clang lang) + __windows_compiler_msvc(${lang}) + endmacro() +else() + include(Platform/Windows-GNU) + macro(__windows_compiler_clang lang) + __windows_compiler_gnu(${lang}) + endmacro() +endif() diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake index ec5f0ae..84cd303 100644 --- a/Modules/Platform/Windows-Intel-CXX.cmake +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -1,4 +1,3 @@ include(Platform/Windows-Intel) set(_COMPILE_CXX " /TP") -set(_FLAGS_CXX " /EHsc /GR") __windows_compiler_intel(CXX) diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 69a7f2f..34e6b37 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -18,92 +18,11 @@ if(__WINDOWS_INTEL) endif() set(__WINDOWS_INTEL 1) -# make sure to enable languages after setting configuration types -enable_language(RC) -set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") - -set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -set(CMAKE_LINK_LIBRARY_FLAG "") -set(WIN32 1) -if(CMAKE_VERBOSE_MAKEFILE) - set(CMAKE_CL_NOLOGO) -else() - set(CMAKE_CL_NOLOGO "/nologo") -endif() -set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") -set(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -set(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -# default to Debug builds -#set(CMAKE_BUILD_TYPE_INIT Debug) -set(CMAKE_BUILD_TYPE_INIT Release) - -set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") -set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") - -# executable linker flags -set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -if(MSVC_C_ARCHITECTURE_ID) - set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") -elseif(MSVC_CXX_ARCHITECTURE_ID) - set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") -elseif(MSVC_Fortran_ARCHITECTURE_ID) - set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") -endif() -set (CMAKE_EXE_LINKER_FLAGS_INIT "/INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") -set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") -set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") - -set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) - -include("${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake" OPTIONAL) - -if(NOT _INTEL_XILINK_TEST_RUN) - execute_process(COMMAND xilink /? - ERROR_VARIABLE _XILINK_ERR - OUTPUT_VARIABLE _XILINK_HELP) - if(_XILINK_HELP MATCHES MANIFEST) - set(_INTEL_COMPILER_SUPPORTS_MANIFEST 1) - endif() - if(NOT EXISTS "${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake") - file(WRITE ${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake - " -set(_INTEL_XILINK_TEST_RUN 1) -set(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST}) -") - endif() -endif() - +include(Platform/Windows-MSVC) macro(__windows_compiler_intel lang) - set(CMAKE_${lang}_COMPILE_OBJECT - "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> /Fd<OBJECT_DIR>/ <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) - set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") - set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") - set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link") - set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> <OBJECTS> /link /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") - set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /RTC1") - set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") - set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") - set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") - - if(_INTEL_COMPILER_SUPPORTS_MANIFEST) - set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}") - set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") - set(CMAKE_${lang}_CREATE_SHARED_MODULE - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}") - endif() + __windows_compiler_msvc(${lang}) + string(REPLACE "<CMAKE_LINKER> /lib" "lib" CMAKE_${lang}_CREATE_STATIC_LIBRARY "${CMAKE_${lang}_CREATE_STATIC_LIBRARY}") + foreach(rule CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) + string(REPLACE "<CMAKE_LINKER>" "xilink" CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}") + endforeach() endmacro() diff --git a/Modules/Platform/Windows-MSVC-C.cmake b/Modules/Platform/Windows-MSVC-C.cmake index e81df9f..cbe1586 100644 --- a/Modules/Platform/Windows-MSVC-C.cmake +++ b/Modules/Platform/Windows-MSVC-C.cmake @@ -1,2 +1,5 @@ include(Platform/Windows-MSVC) +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) + set(_FS_C " /FS") +endif() __windows_compiler_msvc(C) diff --git a/Modules/Platform/Windows-MSVC-CXX.cmake b/Modules/Platform/Windows-MSVC-CXX.cmake index fdd1dae..0e85005 100644 --- a/Modules/Platform/Windows-MSVC-CXX.cmake +++ b/Modules/Platform/Windows-MSVC-CXX.cmake @@ -1,3 +1,6 @@ include(Platform/Windows-MSVC) set(_COMPILE_CXX " /TP") +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) + set(_FS_CXX " /FS") +endif() __windows_compiler_msvc(CXX) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 7036ba0..e29aaf4 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -65,7 +65,13 @@ else() endif() if(NOT MSVC_VERSION) - if(CMAKE_C_COMPILER_VERSION) + if(CMAKE_C_SIMULATE_VERSION) + set(_compiler_version ${CMAKE_C_SIMULATE_VERSION}) + elseif(CMAKE_CXX_SIMULATE_VERSION) + set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION}) + elseif(CMAKE_Fortran_SIMULATE_VERSION) + set(_compiler_version ${CMAKE_Fortran_SIMULATE_VERSION}) + elseif(CMAKE_C_COMPILER_VERSION) set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) else() set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) @@ -178,12 +184,15 @@ set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") # executable linker flags set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") # set the machine type -set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) -if(NOT _MACHINE_ARCH_FLAG) - set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) +if(MSVC_C_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") +elseif(MSVC_CXX_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") +elseif(MSVC_Fortran_ARCHITECTURE_ID) + set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") endif() -set (CMAKE_EXE_LINKER_FLAGS_INIT - "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${_MACHINE_ARCH_FLAG}") +set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}") +unset(_MACHINE_ARCH_FLAG) # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype # on versions that support it @@ -220,7 +229,7 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INI set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) macro(__windows_compiler_msvc lang) - if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 14) + if(NOT MSVC_VERSION LESS 1400) # for 2005 make sure the manifest is put in the dll with mt set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll ") set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ") @@ -232,7 +241,7 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") set(CMAKE_${lang}_COMPILE_OBJECT - "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<OBJECT_DIR>/ -c <SOURCE>${CMAKE_END_TEMP_FILE}") + "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<OBJECT_DIR>/${_FS_${lang}} -c <SOURCE>${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake index fc921d7..3240c23 100644 --- a/Modules/Platform/WindowsPaths.cmake +++ b/Modules/Platform/WindowsPaths.cmake @@ -73,11 +73,19 @@ get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}") -# Add other locations. -list(APPEND CMAKE_SYSTEM_PREFIX_PATH - # Project install destination. - "${CMAKE_INSTALL_PREFIX}" - ) +if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) + # Add other locations. + list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # Project install destination. + "${CMAKE_INSTALL_PREFIX}" + ) + if (CMAKE_STAGING_PREFIX) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # User-supplied staging prefix. + "${CMAKE_STAGING_PREFIX}" + ) + endif() +endif() if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") # MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set) @@ -88,8 +96,17 @@ list(APPEND CMAKE_SYSTEM_INCLUDE_PATH ) # mingw can also link against dlls which can also be in /bin, so list this too +if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) + list(APPEND CMAKE_SYSTEM_LIBRARY_PATH + "${CMAKE_INSTALL_PREFIX}/bin" + ) + if (CMAKE_STAGING_PREFIX) + list(APPEND CMAKE_SYSTEM_LIBRARY_PATH + "${CMAKE_STAGING_PREFIX}/bin" + ) + endif() +endif() list(APPEND CMAKE_SYSTEM_LIBRARY_PATH - "${CMAKE_INSTALL_PREFIX}/bin" "${_CMAKE_INSTALL_DIR}/bin" /bin ) |