diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 2 | ||||
-rw-r--r-- | Modules/CheckIPOSupported.cmake | 21 | ||||
-rw-r--r-- | Modules/CompilerId/Xcode-3.pbxproj.in | 3 | ||||
-rw-r--r-- | Modules/ExternalProject.cmake | 37 |
4 files changed, 47 insertions, 16 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 0e8b2af..2b19736 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -611,6 +611,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} endif() endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT MATCHES "^$|[Mm][Aa][Cc][Oo][Ss]") + set(id_code_sign_identity "-") # When targeting macOS, use only the host architecture. if (_CMAKE_APPLE_ARCHS_DEFAULT) set(id_archs "ARCHS = \"${_CMAKE_APPLE_ARCHS_DEFAULT}\";") @@ -620,6 +621,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_arch_active "ONLY_ACTIVE_ARCH = YES;") endif() else() + set(id_code_sign_identity "") set(id_archs "") set(id_arch_active "ONLY_ACTIVE_ARCH = YES;") endif() diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake index 0bc3c92..cca1be9 100644 --- a/Modules/CheckIPOSupported.cmake +++ b/Modules/CheckIPOSupported.cmake @@ -36,6 +36,11 @@ module will return error in this case. See policy :policy:`CMP0069` for details. .. versionadded:: 3.13 Add support for Visual Studio generators. +.. versionadded:: 3.24 + The check uses the caller's :variable:`CMAKE_<LANG>_FLAGS` + and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` values. + See policy :policy:`CMP0138`. + Examples ^^^^^^^^ @@ -117,6 +122,16 @@ macro(_ipo_run_language_check language) ) endforeach() + if(ipo_CMP0138 STREQUAL "NEW") + set(CMAKE_TRY_COMPILE_CONFIGURATION Debug) + set(_CMAKE_LANG_FLAGS + "-DCMAKE_${language}_FLAGS:STRING=${CMAKE_${language}_FLAGS}" + "-DCMAKE_${language}_FLAGS_DEBUG:STRING=${CMAKE_${language}_FLAGS_DEBUG}" + ) + else() + set(_CMAKE_LANG_FLAGS "") + endif() + try_compile( _IPO_LANGUAGE_CHECK_RESULT "${bindir}" @@ -125,6 +140,7 @@ macro(_ipo_run_language_check language) CMAKE_FLAGS "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" + ${_CMAKE_LANG_FLAGS} OUTPUT_VARIABLE output ) set(_IPO_LANGUAGE_CHECK_RESULT "${_IPO_LANGUAGE_CHECK_RESULT}") @@ -155,6 +171,11 @@ function(check_ipo_supported) message(FATAL_ERROR "Policy CMP0069 set to OLD") endif() + # Save policy setting for condition in _ipo_run_language_check. + cmake_policy(GET CMP0138 ipo_CMP0138 + PARENT_SCOPE # undocumented, do not use outside of CMake + ) + set(optional) set(one RESULT OUTPUT) set(multiple LANGUAGES) diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index aab357a..43e8cc8 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -49,6 +49,7 @@ }; 2C8FEB8E15DC1A1A00E56A5D = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -72,7 +73,7 @@ 1DEB928608733DD80010E9CD = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "@id_code_sign_identity@"; PRODUCT_NAME = CompilerId@id_lang@; }; name = Debug; diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index e19b7c9..701e5fb 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -2063,19 +2063,19 @@ endif() set(${cmd_var} "${command}" PARENT_SCOPE) endfunction() -# This module used to use "/${CMAKE_CFG_INTDIR}" directly and produced -# makefiles with "/./" in paths for custom command dependencies. Which -# resulted in problems with parallel make -j invocations. -# -# This function was added so that the suffix (search below for ${cfgdir}) is -# only set to "/${CMAKE_CFG_INTDIR}" when ${CMAKE_CFG_INTDIR} is not going to -# be "." (multi-configuration build systems like Visual Studio and Xcode...) -# -function(_ep_get_configuration_subdir_suffix suffix_var) +# On multi-config generators, provide a placeholder for a per-config subdir. +# On single-config generators, this is empty. +function(_ep_get_configuration_subdir_genex suffix_var) set(suffix "") get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) - set(suffix "/${CMAKE_CFG_INTDIR}") + if(CMAKE_GENERATOR STREQUAL "Xcode") + # The Xcode generator does not support per-config sources, + # so use the underlying build system's placeholder instead. + set(suffix "/${CMAKE_CFG_INTDIR}") + else() + set(suffix "/$<CONFIG>") + endif() endif() set(${suffix_var} "${suffix}" PARENT_SCOPE) endfunction() @@ -2088,7 +2088,7 @@ function(_ep_get_step_stampfile ) ExternalProject_Get_Property(${name} stamp_dir) - _ep_get_configuration_subdir_suffix(cfgdir) + _ep_get_configuration_subdir_genex(cfgdir) set(stampfile "${stamp_dir}${cfgdir}/${name}-${step}") set(${stampfile_var} "${stampfile}" PARENT_SCOPE) @@ -2100,7 +2100,7 @@ function(_ep_get_complete_stampfile stampfile_var ) set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles) - _ep_get_configuration_subdir_suffix(cfgdir) + _ep_get_configuration_subdir_genex(cfgdir) set(stampfile "${cmf_dir}${cfgdir}/${name}-complete") set(${stampfile_var} ${stampfile} PARENT_SCOPE) @@ -2423,18 +2423,25 @@ function(ExternalProject_Add_Step name step) PROPERTY _EP_${step}_ALWAYS ) if(always) - set_property(SOURCE ${stamp_file} PROPERTY SYMBOLIC 1) set(touch) + # Mark stamp files for all configs as SYMBOLIC since we do not create them. # Remove any existing stamp in case the option changed in an existing tree. get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) + _ep_get_configuration_subdir_genex(cfgdir) foreach(cfg ${CMAKE_CONFIGURATION_TYPES}) - string(REPLACE "/${CMAKE_CFG_INTDIR}" "/${cfg}" + string(REPLACE "${cfgdir}" "/${cfg}" stamp_file_config "${stamp_file}" ) + set_property(SOURCE ${stamp_file_config} PROPERTY SYMBOLIC 1) file(REMOVE ${stamp_file_config}) endforeach() + if(CMAKE_GENERATOR STREQUAL "Xcode") + # See Xcode case in _ep_get_configuration_subdir_genex. + set_property(SOURCE ${stamp_file} PROPERTY SYMBOLIC 1) + endif() else() + set_property(SOURCE ${stamp_file} PROPERTY SYMBOLIC 1) file(REMOVE ${stamp_file}) endif() else() @@ -3940,7 +3947,7 @@ function(ExternalProject_Add name) PARENT_SCOPE # undocumented, do not use outside of CMake ) - _ep_get_configuration_subdir_suffix(cfgdir) + _ep_get_configuration_subdir_genex(cfgdir) # Add a custom target for the external project. set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles) |