diff options
author | Brad King <brad.king@kitware.com> | 2020-12-02 14:29:09 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-12-02 14:29:16 (GMT) |
commit | 9e76ad9ccdb304ce21354c33b6c535eb9556e38d (patch) | |
tree | 7cc9567cd7133427ad9a7de40cb5d08b15255de9 /Modules | |
parent | 2b0152ce093ac041d6e68084eea01f66e5bbb3fa (diff) | |
parent | f8d8faff8d01323d5a48a3b9be55cf9b6e10d5b4 (diff) | |
download | CMake-9e76ad9ccdb304ce21354c33b6c535eb9556e38d.zip CMake-9e76ad9ccdb304ce21354c33b6c535eb9556e38d.tar.gz CMake-9e76ad9ccdb304ce21354c33b6c535eb9556e38d.tar.bz2 |
Merge topic 'ninja-deps-updates'
f8d8faff8d Ninja Generators: Homogenize configuration with Makefiles
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5557
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Platform/Windows-Intel-C.cmake | 20 | ||||
-rw-r--r-- | Modules/Platform/Windows-Intel-CXX.cmake | 22 | ||||
-rw-r--r-- | Modules/Platform/Windows-Intel.cmake | 14 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 3 |
4 files changed, 52 insertions, 7 deletions
diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake index 3cbc7a5..152b27c 100644 --- a/Modules/Platform/Windows-Intel-C.cmake +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -1,11 +1,27 @@ include(Platform/Windows-Intel) __windows_compiler_intel(C) -set(CMAKE_NINJA_DEPTYPE_C intel) # special value handled by CMake + set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>") +set(CMAKE_C_DEPFILE_FORMAT gcc) + +if(CMAKE_GENERATOR MATCHES "^Ninja") + if(_CMAKE_NINJA_VERSION VERSION_LESS 1.9) + # This ninja version is too old to support the Intel depfile format. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_C "/showIncludes") + set(CMAKE_C_DEPFILE_FORMAT msvc) + endif() +endif() if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") # dependencies are computed by the compiler itself - set(CMAKE_C_DEPFILE_FORMAT gcc) set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) endif() + +if("${CMAKE_SOURCE_DIR}${CMAKE_BINARY_DIR}" MATCHES " ") + # The Intel compiler does not properly escape spaces in a depfile. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_C "/showIncludes") + set(CMAKE_C_DEPFILE_FORMAT msvc) +endif() diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake index 6539f64..ce33ae1 100644 --- a/Modules/Platform/Windows-Intel-CXX.cmake +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -1,12 +1,28 @@ include(Platform/Windows-Intel) set(_COMPILE_CXX " /TP") __windows_compiler_intel(CXX) -set(CMAKE_NINJA_DEPTYPE_CXX intel) # special value handled by CMake + set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>") +set(CMAKE_CXX_DEPFILE_FORMAT gcc) + +if(CMAKE_GENERATOR MATCHES "^Ninja") + if(_CMAKE_NINJA_VERSION VERSION_LESS 1.9) + # This ninja version is too old to support the Intel depfile format. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_CXX "/showIncludes") + set(CMAKE_CXX_DEPFILE_FORMAT msvc) + endif() +endif() if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") # dependencies are computed by the compiler itself - set(CMAKE_CXX_DEPFILE_FORMAT gcc) - set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) +endif() + +if("${CMAKE_SOURCE_DIR}${CMAKE_BINARY_DIR}" MATCHES " ") + # The Intel compiler does not properly escape spaces in a depfile. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_CXX "/showIncludes") + set(CMAKE_CXX_DEPFILE_FORMAT msvc) endif() diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 5d8f7fc..01f8dd0 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -8,6 +8,20 @@ if(__WINDOWS_INTEL) endif() set(__WINDOWS_INTEL 1) + +if (CMAKE_GENERATOR MATCHES "^Ninja") + # retrieve ninja version to enable dependencies configuration + # against Ninja capabilities + execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" --version + RESULT_VARIABLE _CMAKE_NINJA_RESULT + OUTPUT_VARIABLE _CMAKE_NINJA_VERSION + ERROR_VARIABLE _CMAKE_NINJA_VERSION) + if (NOT _CMAKE_NINJA_RESULT AND _CMAKE_NINJA_VERSION MATCHES "[0-9]+(\\.[0-9]+)*") + set (_CMAKE_NINJA_VERSION "${CMAKE_MATCH_0}") + endif() + unset(_CMAKE_NINJA_RESULT) +endif() + include(Platform/Windows-MSVC) macro(__windows_compiler_intel lang) __windows_compiler_msvc(${lang}) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index ec5758c..08afd61 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -435,11 +435,10 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -MDd) endif() set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) - set(CMAKE_NINJA_DEPTYPE_${lang} msvc) + __windows_compiler_msvc_enable_rc("${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}") # define generic information about compiler dependencies - # activation is done on per language platform configuration basis if (MSVC_VERSION GREATER 1300) set(CMAKE_DEPFILE_FLAGS_${lang} "/showIncludes") set(CMAKE_${lang}_DEPFILE_FORMAT msvc) |