summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeASMCompiler.cmake.in6
-rw-r--r--Modules/CMakeCCompiler.cmake.in6
-rw-r--r--Modules/CMakeCInformation.cmake2
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in7
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in8
-rw-r--r--Modules/CMakeCXXInformation.cmake4
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake5
-rw-r--r--Modules/CMakeDetermineCompiler.cmake10
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake88
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake45
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake10
-rw-r--r--Modules/CMakeFindBinUtils.cmake11
-rw-r--r--Modules/CMakeFindPackageMode.cmake7
-rw-r--r--Modules/CMakeFortranCompiler.cmake.in4
-rw-r--r--Modules/CMakeFortranCompilerId.F.in2
-rw-r--r--Modules/CMakeFortranInformation.cmake2
-rw-r--r--Modules/CMakeHIPCompiler.cmake.in6
-rw-r--r--Modules/CMakeOBJCCompiler.cmake.in6
-rw-r--r--Modules/CMakeOBJCInformation.cmake2
-rw-r--r--Modules/CMakeOBJCXXCompiler.cmake.in8
-rw-r--r--Modules/CMakeOBJCXXInformation.cmake4
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake256
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake207
-rw-r--r--Modules/CMakeSwiftInformation.cmake118
-rw-r--r--Modules/CSharpUtilities.cmake2
-rw-r--r--Modules/CheckIPOSupported/main.c2
-rw-r--r--Modules/Compiler/ADSP-ASM.cmake6
-rw-r--r--Modules/Compiler/ADSP.cmake2
-rw-r--r--Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/GNU-Fortran.cmake4
-rw-r--r--Modules/Compiler/GNU.cmake43
-rw-r--r--Modules/Compiler/LLVMFlang-Fortran.cmake3
-rw-r--r--Modules/CompilerId/VS-Intel.vfproj.in2
-rw-r--r--Modules/ExternalProject.cmake20
-rw-r--r--Modules/FeatureSummary.cmake2
-rw-r--r--Modules/FetchContent.cmake62
-rw-r--r--Modules/FindBLAS.cmake6
-rw-r--r--Modules/FindCURL.cmake6
-rw-r--r--Modules/FindLAPACK.cmake6
-rw-r--r--Modules/FindOpenGL.cmake34
-rw-r--r--Modules/FindOpenThreads.cmake30
-rw-r--r--Modules/FindPerl.cmake17
-rw-r--r--Modules/FindwxWidgets.cmake82
-rw-r--r--Modules/GoogleTest.cmake8
-rw-r--r--Modules/GoogleTestAddTests.cmake1
-rw-r--r--Modules/Internal/AppleArchitectureSelection.cmake.in8
-rw-r--r--Modules/Internal/ApplePlatformSelection.cmake.in24
-rw-r--r--Modules/Internal/CMakeDetermineLinkerId.cmake104
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake2
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake2
-rw-r--r--Modules/Internal/CPack/CPackWIX.cmake4
-rw-r--r--Modules/Internal/CPack/WIX.template.in5
-rw-r--r--Modules/Platform/ADSP-Common.cmake11
-rw-r--r--Modules/Platform/ADSP-Determine.cmake4
-rw-r--r--Modules/Platform/AIX-GNU.cmake3
-rw-r--r--Modules/Platform/AIX-XL.cmake1
-rw-r--r--Modules/Platform/Apple-Clang.cmake9
-rw-r--r--Modules/Platform/Apple-GNU.cmake3
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake2
-rw-r--r--Modules/Platform/Darwin.cmake8
-rw-r--r--Modules/Platform/Linux-Clang-CUDA.cmake2
-rw-r--r--Modules/Platform/Linux-GNU.cmake9
-rw-r--r--Modules/Platform/Linux-LLVMFlang-Fortran.cmake1
-rw-r--r--Modules/Platform/Linux-NVIDIA-CUDA.cmake9
-rw-r--r--Modules/Platform/Windows-Clang.cmake13
-rw-r--r--Modules/Platform/Windows-GNU.cmake7
-rw-r--r--Modules/Platform/Windows-LLVMFlang-Fortran.cmake27
-rw-r--r--Modules/Platform/Windows-MSVC.cmake8
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake6
-rw-r--r--Modules/Platform/Windows.cmake5
-rw-r--r--Modules/UseEcos.cmake40
-rw-r--r--Modules/UseJava/javaTargets.cmake.in3
-rw-r--r--Modules/UseSWIG.cmake2
73 files changed, 1166 insertions, 325 deletions
diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in
index 1efd9f5..c7dbfae 100644
--- a/Modules/CMakeASMCompiler.cmake.in
+++ b/Modules/CMakeASMCompiler.cmake.in
@@ -5,6 +5,12 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_AR "@_CMAKE_ASM_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_RANLIB "@_CMAKE_ASM_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER "@CMAKE_ASM_COMPILER_LINKER@")
+set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_ID "@CMAKE_ASM_COMPILER_LINKER_ID@")
+set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_VERSION @CMAKE_ASM_COMPILER_LINKER_VERSION@)
+set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_ASM_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 2f0b774..df2a060 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -26,6 +26,12 @@ set(CMAKE_C_COMPILER_AR "@CMAKE_C_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_C_COMPILER_RANLIB "@CMAKE_C_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_C_COMPILER_LINKER "@CMAKE_C_COMPILER_LINKER@")
+set(CMAKE_C_COMPILER_LINKER_ID "@CMAKE_C_COMPILER_LINKER_ID@")
+set(CMAKE_C_COMPILER_LINKER_VERSION @CMAKE_C_COMPILER_LINKER_VERSION@)
+set(CMAKE_C_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_C_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index 665f309..998e476 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -67,7 +67,7 @@ if (NOT _INCLUDED_FILE)
endif ()
if(CMAKE_C_SIZEOF_DATA_PTR)
- foreach(f ${CMAKE_C_ABI_FILES})
+ foreach(f IN LISTS CMAKE_C_ABI_FILES)
include(${f})
endforeach()
unset(CMAKE_C_ABI_FILES)
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 3c28c28..3af02a4 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -72,5 +72,12 @@ set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FR
@_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT@
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_CUDA_COMPILER_LINKER "@CMAKE_CUDA_COMPILER_LINKER@")
+set(CMAKE_CUDA_COMPILER_LINKER_ID "@CMAKE_CUDA_COMPILER_LINKER_ID@")
+set(CMAKE_CUDA_COMPILER_LINKER_VERSION @CMAKE_CUDA_COMPILER_LINKER_VERSION@)
+set(CMAKE_CUDA_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_CUDA_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_AR "@CMAKE_AR@")
+set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_MT "@CMAKE_MT@")
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 8b6f82b..4459898 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -27,6 +27,12 @@ set(CMAKE_CXX_COMPILER_AR "@CMAKE_CXX_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_CXX_COMPILER_RANLIB "@CMAKE_CXX_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_CXX_COMPILER_LINKER "@CMAKE_CXX_COMPILER_LINKER@")
+set(CMAKE_CXX_COMPILER_LINKER_ID "@CMAKE_CXX_COMPILER_LINKER_ID@")
+set(CMAKE_CXX_COMPILER_LINKER_VERSION @CMAKE_CXX_COMPILER_LINKER_VERSION@)
+set(CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
@@ -40,7 +46,7 @@ set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
-foreach (lang C OBJC OBJCXX)
+foreach (lang IN ITEMS C OBJC OBJCXX)
if (CMAKE_${lang}_COMPILER_ID_RUN)
foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS)
list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension})
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 53abf37..3753d18 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -66,7 +66,7 @@ if (NOT _INCLUDED_FILE)
endif ()
if(CMAKE_CXX_SIZEOF_DATA_PTR)
- foreach(f ${CMAKE_CXX_ABI_FILES})
+ foreach(f IN LISTS CMAKE_CXX_ABI_FILES)
include(${f})
endforeach()
unset(CMAKE_CXX_ABI_FILES)
@@ -182,7 +182,7 @@ if(NOT CMAKE_SHARED_MODULE_CXX_FLAGS)
endif()
# Initialize CXX link type selection flags from C versions.
-foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
+foreach(type IN ITEMS SHARED_LIBRARY SHARED_MODULE EXE)
if(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS)
set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS
${CMAKE_${type}_LINK_STATIC_C_FLAGS})
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 7eb93e2..e4fa43f 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -42,11 +42,6 @@ function(compiler_id_detection outvar lang)
# Order is relevant here. For example, compilers which pretend to be
# GCC must appear before the actual GCC.
- if ("x${lang}" STREQUAL "xCXX")
- list(APPEND ordered_compilers
- Comeau
- )
- endif()
list(APPEND ordered_compilers
Intel
IntelLLVM
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index 3156ca9..fc0b714 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -15,7 +15,7 @@ macro(_cmake_find_compiler lang)
set(_${lang}_COMPILER_LIST "${CMAKE_${lang}_COMPILER_LIST}")
set(CMAKE_${lang}_COMPILER_LIST "")
# Prefer vendors of compilers from reference languages.
- foreach(l ${_languages})
+ foreach(l IN LISTS _languages)
list(APPEND CMAKE_${lang}_COMPILER_LIST
${_${lang}_COMPILER_NAMES_${CMAKE_${l}_COMPILER_ID}})
endforeach()
@@ -33,7 +33,7 @@ macro(_cmake_find_compiler lang)
# Look for directories containing compilers of reference languages.
set(_${lang}_COMPILER_HINTS "${CMAKE_${lang}_COMPILER_HINTS}")
- foreach(l ${_languages})
+ foreach(l IN LISTS _languages)
if(CMAKE_${l}_COMPILER AND IS_ABSOLUTE "${CMAKE_${l}_COMPILER}")
get_filename_component(_hint "${CMAKE_${l}_COMPILER}" PATH)
if(IS_DIRECTORY "${_hint}")
@@ -99,7 +99,7 @@ macro(_cmake_find_compiler lang)
if (CMAKE_${lang}_COMPILER MATCHES "^/usr/bin/(.+)$")
_query_xcrun("${CMAKE_MATCH_1}" RESULT_VAR xcrun_result)
elseif (CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND")
- foreach(comp ${CMAKE_${lang}_COMPILER_LIST})
+ foreach(comp IN LISTS CMAKE_${lang}_COMPILER_LIST)
_query_xcrun("${comp}" RESULT_VAR xcrun_result)
if(xcrun_result)
break()
@@ -120,6 +120,10 @@ macro(_cmake_find_compiler_path lang)
# CMAKE_${lang}_COMPILER and the rest as CMAKE_${lang}_COMPILER_ARG1
# Otherwise, preserve any existing CMAKE_${lang}_COMPILER_ARG1 that might
# have been saved by CMakeDetermine${lang}Compiler in a previous run.
+
+ # Necessary for Windows paths to avoid improper escaping of backslashes
+ cmake_path(CONVERT "${CMAKE_${lang}_COMPILER}" TO_CMAKE_PATH_LIST CMAKE_${lang}_COMPILER NORMALIZE)
+
list(LENGTH CMAKE_${lang}_COMPILER _CMAKE_${lang}_COMPILER_LENGTH)
if(_CMAKE_${lang}_COMPILER_LENGTH GREATER 1)
set(CMAKE_${lang}_COMPILER_ARG1 "${CMAKE_${lang}_COMPILER}")
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index efc18f9..012a87c 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -6,6 +6,7 @@
# This is used internally by CMake and should not be included by user
# code.
+include(${CMAKE_ROOT}/Modules/Internal/CMakeDetermineLinkerId.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
include(${CMAKE_ROOT}/Modules/CMakeParseLibraryArchitecture.cmake)
@@ -19,15 +20,19 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin")
set(CMAKE_FLAGS )
set(COMPILE_DEFINITIONS )
+ set(LINK_OPTIONS )
if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
- set(CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
+ set(LINK_OPTIONS "${CMAKE_${lang}_VERBOSE_FLAG}")
set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_FLAG}")
endif()
if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG)
set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}")
endif()
+ if(DEFINED CMAKE_${lang}_VERBOSE_LINK_FLAG)
+ list(APPEND LINK_OPTIONS "${CMAKE_${lang}_VERBOSE_LINK_FLAG}")
+ endif()
if(lang MATCHES "^(CUDA|HIP)$")
- if(CMAKE_${lang}_ARCHITECTURES STREQUAL "native")
+ if(CMAKE_CUDA_ARCHITECTURES STREQUAL "native")
# We are about to detect the native architectures, so we do
# not yet know them. Use all architectures during detection.
set(CMAKE_${lang}_ARCHITECTURES "all")
@@ -39,6 +44,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
# from which we might detect implicit link libraries.
list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=")
endif()
+ list(JOIN LINK_OPTIONS " " LINK_OPTIONS)
+ list(APPEND CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${LINK_OPTIONS}")
+
__TestCompiler_setTryCompileTargetType()
# Avoid failing ABI detection on warnings.
@@ -53,7 +61,6 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(ENV{LC_ALL} C)
set(ENV{LC_MESSAGES} C)
set(ENV{LANG} C)
-
try_compile(CMAKE_${lang}_ABI_COMPILED
SOURCES ${src}
CMAKE_FLAGS ${CMAKE_FLAGS}
@@ -146,39 +153,42 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
set(implicit_libs "${CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES}")
set(implicit_fwks "${CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES}")
else()
- # Parse implicit linker information for this language, if available.
- set(implicit_dirs "")
- set(implicit_objs "")
- set(implicit_libs "")
- set(implicit_fwks "")
- if(CMAKE_${lang}_VERBOSE_FLAG)
- CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log
- "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
- COMPUTE_IMPLICIT_OBJECTS implicit_objs
- LANGUAGE ${lang})
- message(CONFIGURE_LOG
- "Parsed ${lang} implicit link information:\n${log}\n\n")
- endif()
- # for VS IDE Intel Fortran we have to figure out the
- # implicit link path for the fortran run time using
- # a try-compile
- if("${lang}" MATCHES "Fortran"
- AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
- message(CHECK_START "Determine Intel Fortran Compiler Implicit Link Path")
- # Build a sample project which reports symbols.
- try_compile(IFORT_LIB_PATH_COMPILED
- PROJECT IntelFortranImplicit
- SOURCE_DIR ${CMAKE_ROOT}/Modules/IntelVSImplicitPath
- BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath
- CMAKE_FLAGS
- "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
- OUTPUT_VARIABLE _output)
- file(WRITE
- "${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
- "${_output}")
- include(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
- message(CHECK_PASS "done")
- endif()
+ # Parse implicit linker information for this language, if available.
+ set(implicit_dirs "")
+ set(implicit_objs "")
+ set(implicit_libs "")
+ set(implicit_fwks "")
+ set(compute_artifacts COMPUTE_LINKER linker_tool)
+ if(CMAKE_${lang}_VERBOSE_FLAG)
+ list(APPEND compute_artifacts COMPUTE_IMPLICIT_LIBS implicit_libs
+ COMPUTE_IMPLICIT_DIRS implicit_dirs
+ COMPUTE_IMPLICIT_FWKS implicit_fwks
+ COMPUTE_IMPLICIT_OBJECTS implicit_objs)
+ endif()
+ cmake_parse_implicit_link_info2("${OUTPUT}" log "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}"
+ ${compute_artifacts} LANGUAGE ${lang})
+ message(CONFIGURE_LOG
+ "Parsed ${lang} implicit link information:\n${log}\n\n")
+ # for VS IDE Intel Fortran we have to figure out the
+ # implicit link path for the fortran run time using
+ # a try-compile
+ if("${lang}" MATCHES "Fortran"
+ AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+ message(CHECK_START "Determine Intel Fortran Compiler Implicit Link Path")
+ # Build a sample project which reports symbols.
+ try_compile(IFORT_LIB_PATH_COMPILED
+ PROJECT IntelFortranImplicit
+ SOURCE_DIR ${CMAKE_ROOT}/Modules/IntelVSImplicitPath
+ BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath
+ CMAKE_FLAGS
+ "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
+ OUTPUT_VARIABLE _output)
+ file(WRITE
+ "${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
+ "${_output}")
+ include(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
+ message(CHECK_PASS "done")
+ endif()
endif()
# Implicit link libraries cannot be used explicitly for multiple
@@ -193,6 +203,12 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
list(REMOVE_ITEM implicit_dirs $ENV{CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES_EXCLUDE})
endif()
+ set(CMAKE_${lang}_COMPILER_LINKER "${linker_tool}" PARENT_SCOPE)
+ cmake_determine_linker_id(${lang} "${linker_tool}")
+ set(CMAKE_${lang}_COMPILER_LINKER_ID "${CMAKE_${lang}_COMPILER_LINKER_ID}" PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_LINKER_VERSION ${CMAKE_${lang}_COMPILER_LINKER_VERSION} PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT ${CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT} PARENT_SCOPE)
+
set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 4f1eaba..b380aa5 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -174,27 +174,30 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
endif()
- # FIXME(LLVMFlang): It does not provide predefines identifying the MSVC ABI or architecture.
- # It should be taught to define _MSC_VER and its _M_* architecture flags.
if("x${lang}" STREQUAL "xFortran" AND "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xLLVMFlang")
- # Parse the target triple to detect information we should later be able
- # to get during preprocessing above, once LLVMFlang provides it.
+ # Parse the target triple to detect information not always available from the preprocessor.
if(COMPILER_${lang}_PRODUCED_OUTPUT MATCHES "-triple ([0-9a-z_]*)-.*windows-msvc([0-9]+)\\.([0-9]+)")
- set(CMAKE_${lang}_SIMULATE_ID "MSVC")
+ # CMakeFortranCompilerId.F.in does not extract the _MSC_VER minor version.
+ # We can do better using the version parsed here.
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
- set(arch ${CMAKE_MATCH_1})
- if(arch STREQUAL "x86_64")
- set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "x64")
- elseif(arch STREQUAL "aarch64")
- set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "ARM64")
- elseif(arch STREQUAL "arm64ec")
- set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "ARM64EC")
- elseif(arch MATCHES "^i[3-9]86$")
- set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "X86")
- else()
- message(FATAL_ERROR "LLVMFlang target architecture unrecognized: ${arch}")
+
+ if (CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 18.0)
+ # LLVMFlang < 18.0 does not provide predefines identifying the MSVC ABI or architecture.
+ set(CMAKE_${lang}_SIMULATE_ID "MSVC")
+ set(arch ${CMAKE_MATCH_1})
+ if(arch STREQUAL "x86_64")
+ set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "x64")
+ elseif(arch STREQUAL "aarch64")
+ set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "ARM64")
+ elseif(arch STREQUAL "arm64ec")
+ set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "ARM64EC")
+ elseif(arch MATCHES "^i[3-9]86$")
+ set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "X86")
+ else()
+ message(FATAL_ERROR "LLVMFlang target architecture unrecognized: ${arch}")
+ endif()
+ set(MSVC_${lang}_ARCHITECTURE_ID "${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}")
endif()
- set(MSVC_${lang}_ARCHITECTURE_ID "${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}")
elseif(COMPILER_${lang}_PRODUCED_OUTPUT MATCHES "-triple ([0-9a-z_]*)-.*windows-gnu")
set(CMAKE_${lang}_SIMULATE_ID "GNU")
endif()
@@ -402,7 +405,13 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
elseif(lang STREQUAL Fortran)
set(v Intel)
set(ext vfproj)
- set(id_cl ifort.exe)
+ if(CMAKE_VS_PLATFORM_TOOLSET_FORTRAN)
+ set(id_cl "${CMAKE_VS_PLATFORM_TOOLSET_FORTRAN}.exe")
+ set(id_UseCompiler "UseCompiler=\"${CMAKE_VS_PLATFORM_TOOLSET_FORTRAN}Compiler\"")
+ else()
+ set(id_cl ifort.exe)
+ set(id_UseCompiler "")
+ endif()
elseif(lang STREQUAL CSharp)
set(v 10)
set(ext csproj)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 392f0f1..613b0c4 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -22,7 +22,7 @@ elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
_cmake_find_compiler_path(Fortran)
else()
if(NOT CMAKE_Fortran_COMPILER)
- # prefer the environment variable CC
+ # prefer the environment variable FC
if(NOT $ENV{FC} STREQUAL "")
get_filename_component(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT)
if(CMAKE_Fortran_FLAGS_ENV_INIT)
@@ -140,11 +140,11 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_INDEX 2)
set(_version_info "")
- foreach(m MAJOR MINOR PATCH TWEAK)
+ foreach(m IN ITEMS MAJOR MINOR PATCH TWEAK)
set(_COMP "_${m}")
string(APPEND _version_info "
#if defined(COMPILER_VERSION${_COMP})")
- foreach(d 1 2 3 4 5 6 7 8)
+ foreach(d RANGE 1 8)
string(APPEND _version_info "
# undef DEC
# undef HEX
@@ -265,8 +265,8 @@ if("${CMAKE_Fortran_COMPILER_ID};${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "LLVMFla
"${log}\n"
)
set(_CMAKE_Fortran_IMPLICIT_LINK_INFORMATION_DETERMINED_EARLY 1)
- if("x${CMAKE_Fortran_COMPILER_ARCHITECTURE_ID}" STREQUAL "xARM64")
- # FIXME(LLVMFlang): It does not add `-defaultlib:` fields to object
+ if("x${CMAKE_Fortran_COMPILER_ARCHITECTURE_ID}" STREQUAL "xARM64" AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 18.0)
+ # LLVMFlang < 18.0 does not add `-defaultlib:` fields to object
# files to specify link dependencies on its runtime libraries.
# For now, we add them ourselves.
list(APPEND CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "clang_rt.builtins-aarch64.lib")
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e12b175..cf270c0 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -60,6 +60,13 @@ endfunction()
__resolve_tool_path(CMAKE_LINKER "${_CMAKE_TOOLCHAIN_LOCATION}" "Default Linker")
__resolve_tool_path(CMAKE_MT "${_CMAKE_TOOLCHAIN_LOCATION}" "Default Manifest Tool")
+macro(__resolve_linker_path __linker_type __name __search_path __doc)
+ if(NOT CMAKE_LINKER_${__linker_type})
+ set( CMAKE_LINKER_${__linker_type} "${__name}")
+ endif()
+ __resolve_tool_path(CMAKE_LINKER_${__linker_type} "${__search_path}" "${__doc}")
+endmacro()
+
set(_CMAKE_TOOL_VARS "")
# if it's the MS C/CXX compiler, search for link
@@ -93,6 +100,10 @@ if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND
list(APPEND _CMAKE_TOOL_VARS LINKER MT AR)
+ # look-up for possible usable linker
+ __resolve_linker_path(LINK "link" "${_CMAKE_TOOLCHAIN_LOCATION}" "link Linker")
+ __resolve_linker_path(LLD "lld-link" "${_CMAKE_TOOLCHAIN_LOCATION}" "lld-link Linker")
+
elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^x(Open)?Watcom$")
set(_CMAKE_LINKER_NAMES "wlink")
set(_CMAKE_AR_NAMES "wlib")
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index 726e2a2..a6bbcc4 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -5,10 +5,9 @@
CMakeFindPackageMode
--------------------
-
-
-This file is executed by cmake when invoked with --find-package. It
-expects that the following variables are set using -D:
+This file is executed by cmake when invoked with
+:ref:`--find-package <Find-Package Tool Mode>`.
+It expects that the following variables are set using ``-D``:
``NAME``
name of the package
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in
index 89a00ab..90c2ad0 100644
--- a/Modules/CMakeFortranCompiler.cmake.in
+++ b/Modules/CMakeFortranCompiler.cmake.in
@@ -15,6 +15,10 @@ set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_Fortran_COMPILER_AR "@CMAKE_Fortran_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_Fortran_COMPILER_LINKER "@CMAKE_Fortran_COMPILER_LINKER@")
+set(CMAKE_Fortran_COMPILER_LINKER_ID "@CMAKE_Fortran_COMPILER_LINKER_ID@")
+set(CMAKE_Fortran_COMPILER_LINKER_VERSION @CMAKE_Fortran_COMPILER_LINKER_VERSION@)
+set(CMAKE_Fortran_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_Fortran_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_Fortran_COMPILER_RANLIB "@CMAKE_Fortran_COMPILER_RANLIB@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@)
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index f5c2ab5..a040073 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -240,7 +240,7 @@
#else
PRINT *, 'INFO:platform[]'
#endif
-#if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC))
+#if defined(_MSC_VER)
# if defined(_M_IA64)
PRINT *, 'INFO:arch[IA64]'
# elif defined(_M_X64) || defined(_M_AMD64)
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 0f71c6f..e364755 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -43,7 +43,7 @@ if (NOT _INCLUDED_FILE)
endif ()
if(CMAKE_Fortran_SIZEOF_DATA_PTR)
- foreach(f ${CMAKE_Fortran_ABI_FILES})
+ foreach(f IN LISTS CMAKE_Fortran_ABI_FILES)
include(${f})
endforeach()
unset(CMAKE_Fortran_ABI_FILES)
diff --git a/Modules/CMakeHIPCompiler.cmake.in b/Modules/CMakeHIPCompiler.cmake.in
index 6d5e62a..9d70e03 100644
--- a/Modules/CMakeHIPCompiler.cmake.in
+++ b/Modules/CMakeHIPCompiler.cmake.in
@@ -74,5 +74,11 @@ set(CMAKE_HIP_COMPILER_AR "@CMAKE_HIP_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_HIP_COMPILER_RANLIB "@CMAKE_HIP_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_HIP_COMPILER_LINKER "@CMAKE_HIP_COMPILER_LINKER@")
+set(CMAKE_HIP_COMPILER_LINKER_ID "@CMAKE_HIP_COMPILER_LINKER_ID@")
+set(CMAKE_HIP_COMPILER_LINKER_VERSION @CMAKE_HIP_COMPILER_LINKER_VERSION@)
+set(CMAKE_HIP_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_HIP_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in
index de73645..a8bb0d2 100644
--- a/Modules/CMakeOBJCCompiler.cmake.in
+++ b/Modules/CMakeOBJCCompiler.cmake.in
@@ -24,6 +24,12 @@ set(CMAKE_OBJC_COMPILER_AR "@CMAKE_OBJC_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_OBJC_COMPILER_RANLIB "@CMAKE_OBJC_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_OBJC_COMPILER_LINKER "@CMAKE_OBJC_COMPILER_LINKER@")
+set(CMAKE_OBJC_COMPILER_LINKER_ID "@CMAKE_OBJC_COMPILER_LINKER_ID@")
+set(CMAKE_OBJC_COMPILER_LINKER_VERSION @CMAKE_OBJC_COMPILER_LINKER_VERSION@)
+set(CMAKE_OBJC_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_OBJC_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUOBJC @CMAKE_COMPILER_IS_GNUOBJC@)
diff --git a/Modules/CMakeOBJCInformation.cmake b/Modules/CMakeOBJCInformation.cmake
index 4c697da..8b8f10e 100644
--- a/Modules/CMakeOBJCInformation.cmake
+++ b/Modules/CMakeOBJCInformation.cmake
@@ -67,7 +67,7 @@ if (NOT _INCLUDED_FILE)
endif ()
if(CMAKE_OBJC_SIZEOF_DATA_PTR)
- foreach(f ${CMAKE_OBJC_ABI_FILES})
+ foreach(f IN LISTS CMAKE_OBJC_ABI_FILES)
include(${f})
endforeach()
unset(CMAKE_OBJC_ABI_FILES)
diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in
index 94d24ff..6a80d50 100644
--- a/Modules/CMakeOBJCXXCompiler.cmake.in
+++ b/Modules/CMakeOBJCXXCompiler.cmake.in
@@ -25,6 +25,12 @@ set(CMAKE_OBJCXX_COMPILER_AR "@CMAKE_OBJCXX_COMPILER_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_OBJCXX_COMPILER_RANLIB "@CMAKE_OBJCXX_COMPILER_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
+set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
+set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
+set(CMAKE_OBJCXX_COMPILER_LINKER "@CMAKE_OBJCXX_COMPILER_LINKER@")
+set(CMAKE_OBJCXX_COMPILER_LINKER_ID "@CMAKE_OBJCXX_COMPILER_LINKER_ID@")
+set(CMAKE_OBJCXX_COMPILER_LINKER_VERSION @CMAKE_OBJCXX_COMPILER_LINKER_VERSION@)
+set(CMAKE_OBJCXX_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_OBJCXX_COMPILER_LINKER_FRONTEND_VARIANT@)
set(CMAKE_MT "@CMAKE_MT@")
set(CMAKE_TAPI "@CMAKE_TAPI@")
set(CMAKE_COMPILER_IS_GNUOBJCXX @CMAKE_COMPILER_IS_GNUOBJCXX@)
@@ -44,7 +50,7 @@ if (CMAKE_OBJC_COMPILER_ID_RUN)
endforeach()
endif()
-foreach (lang C CXX OBJC)
+foreach (lang IN ITEMS C CXX OBJC)
foreach(extension IN LISTS CMAKE_OBJCXX_SOURCE_FILE_EXTENSIONS)
if (CMAKE_${lang}_COMPILER_ID_RUN)
list(REMOVE_ITEM CMAKE_${lang}_SOURCE_FILE_EXTENSIONS ${extension})
diff --git a/Modules/CMakeOBJCXXInformation.cmake b/Modules/CMakeOBJCXXInformation.cmake
index a6d824f..da1d6c6 100644
--- a/Modules/CMakeOBJCXXInformation.cmake
+++ b/Modules/CMakeOBJCXXInformation.cmake
@@ -62,7 +62,7 @@ if (NOT _INCLUDED_FILE)
endif ()
if(CMAKE_OBJCXX_SIZEOF_DATA_PTR)
- foreach(f ${CMAKE_OBJCXX_ABI_FILES})
+ foreach(f IN LISTS CMAKE_OBJCXX_ABI_FILES)
include(${f})
endforeach()
unset(CMAKE_OBJCXX_ABI_FILES)
@@ -178,7 +178,7 @@ if(NOT CMAKE_SHARED_MODULE_OBJCXX_FLAGS)
endif()
# Initialize OBJCXX link type selection flags from OBJC versions.
-foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
+foreach(type IN ITEMS SHARED_LIBRARY SHARED_MODULE EXE)
if(NOT CMAKE_${type}_LINK_STATIC_OBJCXX_FLAGS)
set(CMAKE_${type}_LINK_STATIC_OBJCXX_FLAGS
${CMAKE_${type}_LINK_STATIC_OBJC_FLAGS})
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 581e65c..eeab67b 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -8,9 +8,6 @@ CMakePackageConfigHelpers
Helpers functions for creating config files that can be included by other
projects to find and use a package.
-Adds the :command:`configure_package_config_file()` and
-:command:`write_basic_package_version_file()` commands.
-
Generating a Package Configuration File
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -190,6 +187,132 @@ Please note that these files are internal to CMake and you should not call
:command:`configure_file()` on them yourself, but they can be used as starting
point to create more sophisticated custom ``ConfigVersion.cmake`` files.
+Generating an Apple Platform Selection File
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. command:: generate_apple_platform_selection_file
+
+ .. versionadded:: 3.29
+
+ Create an Apple platform selection file:
+
+ .. code-block:: cmake
+
+ generate_apple_platform_selection_file(<filename>
+ INSTALL_DESTINATION <path>
+ [INSTALL_PREFIX <path>]
+ [MACOS_CONFIG_FILE <file>]
+ [IOS_CONFIG_FILE <file>]
+ [IOS_SIMULATOR_CONFIG_FILE <file>]
+ [TVOS_CONFIG_FILE <file>]
+ [TVOS_SIMULATOR_CONFIG_FILE <file>]
+ [WATCHOS_CONFIG_FILE <file>]
+ [WATCHOS_SIMULATOR_CONFIG_FILE <file>]
+ [VISIONOS_CONFIG_FILE <file>]
+ [VISIONOS_SIMULATOR_CONFIG_FILE <file>]
+ )
+
+ Writes a file for use as ``<PackageName>Config.cmake`` which can include an
+ Apple-platform-specific ``<PackageName>Config.cmake`` from a different
+ directory. This can be used in conjunction with the ``XCFRAMEWORK_LOCATION``
+ argument of :command:`export(SETUP)` to export packages in a way that a project
+ built for any Apple platform can use them.
+
+ ``INSTALL_DESTINATION <path>``
+ Path to which the file will be installed by the caller, e.g., via
+ :command:`install(FILES)`. The path may be either relative to the
+ ``INSTALL_PREFIX`` or absolute.
+
+ ``INSTALL_PREFIX <path>``
+ Path prefix to which the package will be installed by the caller.
+ The ``<path>`` argument must be an absolute path. If this argument
+ is not passed, the :variable:`CMAKE_INSTALL_PREFIX` variable will be
+ used instead.
+
+ ``MACOS_CONFIG_FILE <file>``
+ File to include if the platform is macOS.
+
+ ``IOS_CONFIG_FILE <file>``
+ File to include if the platform is iOS.
+
+ ``IOS_SIMULATOR_CONFIG_FILE <file>``
+ File to include if the platform is iOS Simulator.
+
+ ``TVOS_CONFIG_FILE <file>``
+ File to include if the platform is tvOS.
+
+ ``TVOS_SIMULATOR_CONFIG_FILE <file>``
+ File to include if the platform is tvOS Simulator.
+
+ ``WATCHOS_CONFIG_FILE <file>``
+ File to include if the platform is watchOS.
+
+ ``WATCHOS_SIMULATOR_CONFIG_FILE <file>``
+ File to include if the platform is watchOS Simulator.
+
+ ``VISIONOS_CONFIG_FILE <file>``
+ File to include if the platform is visionOS.
+
+ ``VISIONOS_SIMULATOR_CONFIG_FILE <file>``
+ File to include if the platform is visionOS Simulator.
+
+ If any of the optional config files are not specified, and the consuming
+ project is built for their corresponding platform, an error will be thrown
+ when including the generated file.
+
+.. command:: generate_apple_architecture_selection_file
+
+ .. versionadded:: 3.29
+
+ Create an Apple architecture selection file:
+
+ .. code-block:: cmake
+
+ generate_apple_architecture_selection_file(<filename>
+ INSTALL_DESTINATION <path>
+ [INSTALL_PREFIX <path>]
+ [SINGLE_ARCHITECTURES <archs>
+ SINGLE_ARCHITECTURE_CONFIG_FILES <files>]
+ [UNIVERSAL_ARCHITECTURES <archs>
+ UNIVERSAL_CONFIG_FILE <file>]
+ )
+
+ Writes a file for use as ``<PackageName>Config.cmake`` on Apple platforms
+ which can include an architecture-specific ``<PackageName>Config.cmake``
+ from a different directory based on :variable:`CMAKE_OSX_ARCHITECTURES`.
+
+ ``INSTALL_DESTINATION <path>``
+ Path to which the file will be installed by the caller, e.g., via
+ :command:`install(FILES)`. The path may be either relative to the
+ ``INSTALL_PREFIX`` or absolute.
+
+ ``INSTALL_PREFIX <path>``
+ Path prefix to which the package will be installed by the caller.
+ The ``<path>`` argument must be an absolute path. If this argument
+ is not passed, the :variable:`CMAKE_INSTALL_PREFIX` variable will be
+ used instead.
+
+ ``SINGLE_ARCHITECTURES <archs>``
+ A :ref:`semicolon-separated list <CMake Language Lists>` of
+ architectures provided by entries of
+ ``SINGLE_ARCHITECTURE_CONFIG_FILES``.
+
+ ``SINGLE_ARCHITECTURE_CONFIG_FILES <files>``
+ A :ref:`semicolon-separated list <CMake Language Lists>` of
+ architecture-specific files. One of them will be loaded
+ when :variable:`CMAKE_OSX_ARCHITECTURES` contains a single
+ architecture matching the corresponding entry of
+ ``SINGLE_ARCHITECTURES``.
+
+ ``UNIVERSAL_ARCHITECTURES <archs>``
+ A :ref:`semicolon-separated list <CMake Language Lists>` of
+ architectures provided by the ``UNIVERSAL_CONFIG_FILE``.
+
+ ``UNIVERSAL_CONFIG_FILE <file>``
+ A file to load when :variable:`CMAKE_OSX_ARCHITECTURES` contains
+ a (non-strict) subset of the ``UNIVERSAL_ARCHITECTURES`` and
+ does not match any one of the ``SINGLE_ARCHITECTURES``.
+
Example Generating Package Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -344,3 +467,130 @@ endmacro()
configure_file("${_inputFile}" "${_outputFile}" @ONLY)
endfunction()
+
+function(generate_apple_platform_selection_file _output_file)
+ set(_config_file_options
+ MACOS_CONFIG_FILE
+ IOS_CONFIG_FILE
+ IOS_SIMULATOR_CONFIG_FILE
+ TVOS_CONFIG_FILE
+ TVOS_SIMULATOR_CONFIG_FILE
+ WATCHOS_CONFIG_FILE
+ WATCHOS_SIMULATOR_CONFIG_FILE
+ VISIONOS_CONFIG_FILE
+ VISIONOS_SIMULATOR_CONFIG_FILE
+ )
+
+ set(_options)
+ set(_single
+ INSTALL_DESTINATION
+ INSTALL_PREFIX
+ ${_config_file_options}
+ )
+ set(_multi)
+ cmake_parse_arguments(PARSE_ARGV 0 _gpsf "${_options}" "${_single}" "${_multi}")
+
+ if(NOT _gpsf_INSTALL_DESTINATION)
+ message(FATAL_ERROR "No INSTALL_DESTINATION given to generate_apple_platform_selection_file()")
+ endif()
+ if(_gpsf_INSTALL_PREFIX)
+ set(maybe_INSTALL_PREFIX INSTALL_PREFIX ${_gpsf_INSTALL_PREFIX})
+ else()
+ set(maybe_INSTALL_PREFIX "")
+ endif()
+
+ set(_have_relative 0)
+ foreach(_opt IN LISTS _config_file_options)
+ if(_gpsf_${_opt})
+ set(_config_file "${_gpsf_${_opt}}")
+ if(NOT IS_ABSOLUTE "${_config_file}")
+ string(PREPEND _config_file [[${PACKAGE_PREFIX_DIR}/]])
+ set(_have_relative 1)
+ endif()
+ set(_branch_${_opt} "include(\"${_config_file}\")")
+ else()
+ set(_branch_${_opt} "message(FATAL_ERROR \"Platform not supported\")")
+ endif()
+ endforeach()
+
+ configure_package_config_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Internal/ApplePlatformSelection.cmake.in" "${_output_file}"
+ INSTALL_DESTINATION "${_gpsf_INSTALL_DESTINATION}"
+ ${maybe_INSTALL_PREFIX}
+ NO_SET_AND_CHECK_MACRO
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+ )
+endfunction()
+
+function(generate_apple_architecture_selection_file _output_file)
+ set(_options)
+ set(_single
+ INSTALL_DESTINATION
+ INSTALL_PREFIX
+ SINGLE_ARCHITECTURES
+ SINGLE_ARCHITECTURE_CONFIG_FILES
+ UNIVERSAL_ARCHITECTURES
+ UNIVERSAL_CONFIG_FILE
+ )
+ set(_multi)
+ cmake_parse_arguments(PARSE_ARGV 0 _gasf "${_options}" "${_single}" "${_multi}")
+
+ if(NOT _gasf_INSTALL_DESTINATION)
+ message(FATAL_ERROR "No INSTALL_DESTINATION given to generate_apple_platform_selection_file()")
+ endif()
+ if(_gasf_INSTALL_PREFIX)
+ set(maybe_INSTALL_PREFIX INSTALL_PREFIX ${_gasf_INSTALL_PREFIX})
+ else()
+ set(maybe_INSTALL_PREFIX "")
+ endif()
+
+ list(LENGTH _gasf_SINGLE_ARCHITECTURES _gasf_SINGLE_ARCHITECTURES_len)
+ list(LENGTH _gasf_SINGLE_ARCHITECTURE_CONFIG_FILES _gasf_SINGLE_ARCHITECTURE_CONFIG_FILES_len)
+ if(NOT _gasf_SINGLE_ARCHITECTURES_len EQUAL _gasf_SINGLE_ARCHITECTURE_CONFIG_FILES_len)
+ message(FATAL_ERROR "SINGLE_ARCHITECTURES and SINGLE_ARCHITECTURE_CONFIG_FILES do not have the same number of entries.")
+ endif()
+
+ set(_branch_code "")
+
+ foreach(pair IN ZIP_LISTS _gasf_SINGLE_ARCHITECTURES _gasf_SINGLE_ARCHITECTURE_CONFIG_FILES)
+ set(arch "${pair_0}")
+ set(config_file "${pair_1}")
+ if(NOT IS_ABSOLUTE "${config_file}")
+ string(PREPEND config_file [[${PACKAGE_PREFIX_DIR}/]])
+ endif()
+ string(APPEND _branch_code
+ "\n"
+ "if(CMAKE_OSX_ARCHITECTURES STREQUAL \"${arch}\")\n"
+ " include(\"${config_file}\")\n"
+ " return()\n"
+ "endif()\n"
+ )
+ endforeach()
+
+ if(_gasf_UNIVERSAL_ARCHITECTURES AND _gasf_UNIVERSAL_CONFIG_FILE)
+ string(JOIN " " universal_archs "${_gasf_UNIVERSAL_ARCHITECTURES}")
+ set(config_file "${_gasf_UNIVERSAL_CONFIG_FILE}")
+ if(NOT IS_ABSOLUTE "${config_file}")
+ string(PREPEND config_file [[${PACKAGE_PREFIX_DIR}/]])
+ endif()
+ string(APPEND _branch_code
+ "\n"
+ "set(_cmake_apple_archs \"\${CMAKE_OSX_ARCHITECTURES}\")\n"
+ "list(REMOVE_ITEM _cmake_apple_archs ${universal_archs})\n"
+ "if(NOT _cmake_apple_archs)\n"
+ " include(\"${config_file}\")\n"
+ " return()\n"
+ "endif()\n"
+ )
+ elseif(_gasf_UNIVERSAL_ARCHITECTURES)
+ message(FATAL_ERROR "UNIVERSAL_CONFIG_FILE requires UNIVERSAL_ARCHITECTURES")
+ elseif(_gasf_UNIVERSAL_CONFIG_FILE)
+ message(FATAL_ERROR "UNIVERSAL_ARCHITECTURES requires UNIVERSAL_CONFIG_FILE")
+ endif()
+
+ configure_package_config_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Internal/AppleArchitectureSelection.cmake.in" "${_output_file}"
+ INSTALL_DESTINATION "${_gasf_INSTALL_DESTINATION}"
+ ${maybe_INSTALL_PREFIX}
+ NO_SET_AND_CHECK_MACRO
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+ )
+endfunction()
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index cbdb915..f62de4c 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -15,6 +15,26 @@ cmake_policy(SET CMP0054 NEW)
# compatibility don't break.
#
function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj_regex)
+ set(keywordArgs)
+ set(oneValueArgs LANGUAGE COMPUTE_IMPLICIT_OBJECTS)
+ set(multiValueArgs )
+ cmake_parse_arguments(EXTRA_PARSE "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ cmake_parse_implicit_link_info2("${text}" "${log_var}" "${obj_regex}"
+ COMPUTE_IMPLICIT_LIBS "${lib_var}" COMPUTE_IMPLICIT_DIRS "${dir_var}"
+ COMPUTE_IMPLICIT_FWKS "${fwk_var}" ${ARGN})
+
+ set(${lib_var} "${${lib_var}}" PARENT_SCOPE)
+ set(${dir_var} "${${dir_var}}" PARENT_SCOPE)
+ set(${fwk_var} "${${fwk_var}}" PARENT_SCOPE)
+ set(${log_var} "${${log_var}}" PARENT_SCOPE)
+
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)
+ set(${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS} "${${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS}}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(cmake_parse_implicit_link_info2 text log_var obj_regex)
set(implicit_libs_tmp "")
set(implicit_objs_tmp "")
set(implicit_dirs_tmp)
@@ -22,25 +42,29 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
set(log "")
set(keywordArgs)
- set(oneValueArgs COMPUTE_IMPLICIT_OBJECTS LANGUAGE)
+ set(oneValueArgs LANGUAGE
+ COMPUTE_IMPLICIT_LIBS COMPUTE_IMPLICIT_DIRS COMPUTE_IMPLICIT_FWKS
+ COMPUTE_IMPLICIT_OBJECTS COMPUTE_LINKER)
set(multiValueArgs )
cmake_parse_arguments(EXTRA_PARSE "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(is_msvc 0)
if(EXTRA_PARSE_LANGUAGE AND
- ("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_ID}" STREQUAL "xMSVC" OR
+ ("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC" OR
"x${CMAKE_${EXTRA_PARSE_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC"))
set(is_msvc 1)
endif()
-
# Parse implicit linker arguments.
- set(linker "CMAKE_LINKER-NOTFOUND")
- if(CMAKE_LINKER)
- get_filename_component(linker ${CMAKE_LINKER} NAME)
- string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" linker "${linker}")
- endif()
+ set(linker "ld[0-9]*(\\.[a-z]+)?")
if(is_msvc)
- string(APPEND linker "|link\\.exe|lld-link")
+ string(APPEND linker "|link\\.exe|lld-link(\\.exe)?")
+ endif()
+ if(CMAKE_LINKER)
+ get_filename_component(default_linker ${CMAKE_LINKER} NAME)
+ if (NOT default_linker MATCHES "(${linker})")
+ string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" default_linker "${default_linker}")
+ list(PREPEND linker "${default_linker}|")
+ endif()
endif()
set(startfile "CMAKE_LINK_STARTFILE-NOTFOUND")
if(CMAKE_LINK_STARTFILE)
@@ -50,9 +74,35 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
# whole line and just the command (argv[0]).
set(linker_regex "^( *|.*[/\\])(${linker}|${startfile}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=|/ldfe ")
+ set(linker_tool_regex "^[ \t]*(->|exec:|\")?[ \t]*(.*[/\\](${linker}))(\"|,| |$)")
+ set(linker_tool_exclude_regex "cuda-fake-ld|-fuse-ld=|--with-ld=")
+ set(linker_tool "NOTFOUND")
+ set(link_line_parsed 0)
string(APPEND log " link line regex: [${linker_regex}]\n")
+ if(EXTRA_PARSE_COMPUTE_LINKER)
+ string(APPEND log " linker tool regex: [${linker_tool_regex}]\n")
+ endif()
string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
foreach(line IN LISTS output_lines)
+ if(EXTRA_PARSE_COMPUTE_LINKER AND
+ NOT linker_tool AND NOT "${line}" MATCHES "${linker_tool_exclude_regex}"
+ AND "${line}" MATCHES "${linker_tool_regex}")
+ set(linker_tool "${CMAKE_MATCH_2}")
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ # pick-up last path
+ string(REGEX REPLACE "^.*([A-Za-z]:[/\\][^:]+)$" "\\1" linker_tool "${linker_tool}")
+ cmake_path(SET linker_tool "${linker_tool}")
+ endif()
+ string(APPEND log " linker tool for '${EXTRA_PARSE_LANGUAGE}': ${linker_tool}\n")
+ endif()
+ if(NOT (EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS OR EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS
+ OR EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS OR EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS))
+ if(linker_tool)
+ break()
+ else()
+ continue()
+ endif()
+ endif()
set(cmd)
if("${line}" MATCHES "${linker_regex}" AND
NOT "${line}" MATCHES "${linker_exclude_regex}")
@@ -86,7 +136,8 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
endif()
endif()
set(search_static 0)
- if("${cmd}" MATCHES "${linker_regex}")
+ if(NOT link_line_parsed AND "${cmd}" MATCHES "${linker_regex}")
+ set(link_line_parsed 1)
string(APPEND log " link line: [${line}]\n")
string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}")
set(skip_value_of "")
@@ -95,60 +146,78 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(APPEND log " arg [${arg}] ==> skip value of ${skip_value_of}\n")
set(skip_value_of "")
elseif("${arg}" MATCHES "^-L(.:)?[/\\]")
- # Unix search path.
- string(REGEX REPLACE "^-L" "" dir "${arg}")
- list(APPEND implicit_dirs_tmp ${dir})
- string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ # Unix search path.
+ string(REGEX REPLACE "^-L" "" dir "${arg}")
+ list(APPEND implicit_dirs_tmp ${dir})
+ string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ endif()
elseif("${arg}" MATCHES "^[-/](LIBPATH|libpath):(.+)")
- # MSVC search path.
- set(dir "${CMAKE_MATCH_2}")
- list(APPEND implicit_dirs_tmp ${dir})
- string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ # MSVC search path.
+ set(dir "${CMAKE_MATCH_2}")
+ list(APPEND implicit_dirs_tmp ${dir})
+ string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
+ endif()
elseif(is_msvc AND "${arg}" STREQUAL "-link")
string(APPEND log " arg [${arg}] ==> ignore MSVC cl option\n")
elseif(is_msvc AND "${arg}" MATCHES "^[-/][Ii][Mm][Pp][Ll][Ii][Bb]:")
string(APPEND log " arg [${arg}] ==> ignore MSVC link option\n")
+ elseif(is_msvc AND "${arg}" MATCHES "^[-/][Ww][Hh][Oo][Ll][Ee][Aa][Rr][Cc][Hh][Ii][Vv][Ee]:Fortran_main")
+ string(APPEND log " arg [${arg}] ==> ignore LLVMFlang program entry point\n")
elseif(is_msvc AND "${arg}" MATCHES "^(.*\\.[Ll][Ii][Bb])$")
- set(lib "${CMAKE_MATCH_1}")
- list(APPEND implicit_libs_tmp ${lib})
- string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ set(lib "${CMAKE_MATCH_1}")
+ list(APPEND implicit_libs_tmp ${lib})
+ string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
+ endif()
elseif("${arg}" STREQUAL "-lto_library")
# ld argument "-lto_library <path>"
set(skip_value_of "${arg}")
string(APPEND log " arg [${arg}] ==> ignore, skip following value\n")
elseif("${arg}" MATCHES "^-l([^:].*)$")
- # Unix library.
- set(lib "${CMAKE_MATCH_1}")
- if(search_static AND lib MATCHES "^(gfortran|stdc\\+\\+)$")
- # Search for the static library later, once all link dirs are known.
- set(lib "SEARCH_STATIC:${lib}")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # Unix library.
+ set(lib "${CMAKE_MATCH_1}")
+ if(search_static AND lib MATCHES "^(gfortran|stdc\\+\\+)$")
+ # Search for the static library later, once all link dirs are known.
+ set(lib "SEARCH_STATIC:${lib}")
+ endif()
+ list(APPEND implicit_libs_tmp ${lib})
+ string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
endif()
- list(APPEND implicit_libs_tmp ${lib})
- string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
- # Unix library full path.
- list(APPEND implicit_libs_tmp ${arg})
- string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # Unix library full path.
+ list(APPEND implicit_libs_tmp ${arg})
+ string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
+ endif()
elseif("${arg}" MATCHES "^[-/](DEFAULTLIB|defaultlib):(.+)")
- # Windows library.
- set(lib "${CMAKE_MATCH_2}")
- list(APPEND implicit_libs_tmp ${lib})
- string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # Windows library.
+ set(lib "${CMAKE_MATCH_2}")
+ list(APPEND implicit_libs_tmp ${lib})
+ string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
+ endif()
elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$")
if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)
list(APPEND implicit_objs_tmp ${arg})
string(APPEND log " arg [${arg}] ==> obj [${arg}]\n")
endif()
- if(obj_regex AND "${arg}" MATCHES "${obj_regex}")
- # Object file full path.
- list(APPEND implicit_libs_tmp ${arg})
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ if(obj_regex AND "${arg}" MATCHES "${obj_regex}")
+ # Object file full path.
+ list(APPEND implicit_libs_tmp ${arg})
+ endif()
endif()
elseif("${arg}" MATCHES "^-Y(P,)?[^0-9]")
- # Sun search path ([^0-9] avoids conflict with Mac -Y<num>).
- string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}")
- string(REPLACE ":" ";" dirs "${dirs}")
- list(APPEND implicit_dirs_tmp ${dirs})
- string(APPEND log " arg [${arg}] ==> dirs [${dirs}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ # Sun search path ([^0-9] avoids conflict with Mac -Y<num>).
+ string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}")
+ string(REPLACE ":" ";" dirs "${dirs}")
+ list(APPEND implicit_dirs_tmp ${dirs})
+ string(APPEND log " arg [${arg}] ==> dirs [${dirs}]\n")
+ endif()
elseif("${arg}" STREQUAL "-Bstatic")
set(search_static 1)
string(APPEND log " arg [${arg}] ==> search static\n" )
@@ -156,13 +225,17 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
set(search_static 0)
string(APPEND log " arg [${arg}] ==> search dynamic\n" )
elseif("${arg}" MATCHES "^-l:")
- # HP named library.
- list(APPEND implicit_libs_tmp ${arg})
- string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # HP named library.
+ list(APPEND implicit_libs_tmp ${arg})
+ string(APPEND log " arg [${arg}] ==> lib [${arg}]\n")
+ endif()
elseif("${arg}" MATCHES "^-z(all|default|weak)extract")
- # Link editor option.
- list(APPEND implicit_libs_tmp ${arg})
- string(APPEND log " arg [${arg}] ==> opt [${arg}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ # Link editor option.
+ list(APPEND implicit_libs_tmp ${arg})
+ string(APPEND log " arg [${arg}] ==> opt [${arg}]\n")
+ endif()
elseif("${arg}" STREQUAL "cl.exe")
string(APPEND log " arg [${arg}] ==> recognize MSVC cl\n")
set(is_msvc 1)
@@ -170,25 +243,29 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(APPEND log " arg [${arg}] ==> ignore\n")
endif()
endforeach()
- break()
elseif("${line}" MATCHES "LPATH(=| is:? *)(.*)$")
- string(APPEND log " LPATH line: [${line}]\n")
- # HP search path.
- string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}")
- list(APPEND implicit_dirs_tmp ${paths})
- string(APPEND log " dirs [${paths}]\n")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ string(APPEND log " LPATH line: [${line}]\n")
+ # HP search path.
+ string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}")
+ list(APPEND implicit_dirs_tmp ${paths})
+ string(APPEND log " dirs [${paths}]\n")
+ endif()
else()
string(APPEND log " ignore line: [${line}]\n")
endif()
+ if((NOT EXTRA_PARSE_COMPUTE_LINKER OR linker_tool) AND link_line_parsed)
+ break()
+ endif()
endforeach()
# Look for library search paths reported by linker.
- if("${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS AND "${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)")
string(REPLACE ";\t" ";" implicit_dirs_match "${CMAKE_MATCH_1}")
string(APPEND log " Library search paths: [${implicit_dirs_match}]\n")
list(APPEND implicit_dirs_tmp ${implicit_dirs_match})
endif()
- if("${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)")
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS AND "${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)")
string(REPLACE ";\t" ";" implicit_fwks_match "${CMAKE_MATCH_1}")
string(APPEND log " Framework search paths: [${implicit_fwks_match}]\n")
list(APPEND implicit_fwks_tmp ${implicit_fwks_match})
@@ -273,11 +350,21 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
string(APPEND log " implicit fwks: [${implicit_fwks}]\n")
# Return results.
- set(${lib_var} "${implicit_libs}" PARENT_SCOPE)
- set(${dir_var} "${implicit_dirs}" PARENT_SCOPE)
- set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE)
+ if(EXTRA_PARSE_COMPUTE_LINKER)
+ set(${EXTRA_PARSE_COMPUTE_LINKER} "${linker_tool}" PARENT_SCOPE)
+ endif()
+
set(${log_var} "${log}" PARENT_SCOPE)
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
+ set(${EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS} "${implicit_libs}" PARENT_SCOPE)
+ endif()
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS)
+ set(${EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS} "${implicit_dirs}" PARENT_SCOPE)
+ endif()
+ if(EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS)
+ set(${EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS} "${implicit_fwks}" PARENT_SCOPE)
+ endif()
if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)
set(${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS} "${implicit_objs}" PARENT_SCOPE)
endif()
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index 1c6f0df..04d500e 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -68,30 +68,42 @@ set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -libc MD)
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -libc MTd)
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -libc MDd)
+set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g")
+set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
+set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g")
+set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")
+
if(CMAKE_GENERATOR STREQUAL "Xcode")
+ string(APPEND CMAKE_Swift_FLAGS_DEBUG_INIT " ${CMAKE_Swift_FLAGS_DEBUG_LINKER_FLAGS}")
+ string(APPEND CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT " ${CMAKE_Swift_FLAGS_RELWITHDEBINFO_LINKER_FLAGS}")
+endif()
+
+# Warns if unset and uses old policy.
+# Old policy flag-smashes the wmo and incremental flags onto the compiler flags.
+# New policy respects the Swift_COMPILATION_MODE target property to add
+# incremental and wholemodule optimization flags as appropriate.
+cmake_policy(GET CMP0157 __SWIFT_COMP_MODE_CMP0157)
+if(__SWIFT_COMP_MODE_CMP0157 STREQUAL "NEW")
+ set(CMAKE_Swift_COMPILATION_MODE_DEFAULT "incremental")
+else()
# Xcode has a separate Xcode project option (SWIFT_COMPILATION_MODE) used to set
# whether compiling with whole-module optimizations or incrementally. Setting
# these options here will have no effect when compiling with the built-in driver,
# and will explode violently, leaving build products in the source directory, when
- # using the old swift driver.
- set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g ${CMAKE_Swift_FLAGS_DEBUG_LINKER_FLAGS}")
- set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
- set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g ${CMAKE_Swift_FLAGS_RELWITHDEBINFO_LINKER_FLAGS}")
- set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")
-else()
- set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g -incremental")
- set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
- set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g")
- set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")
-
- # Enable Whole Module Optimization by default unless the old
- # C++ driver is being used, which behaves differently under WMO.
- if(NOT CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
- string(APPEND CMAKE_Swift_FLAGS_RELEASE_INIT " -wmo")
- string(APPEND CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT " -wmo")
- string(APPEND CMAKE_Swift_FLAGS_MINSIZEREL_INIT " -wmo")
+ # using the old swift driver. Don't append `-incremental` or `-wmo` to the
+ # flags in the Xcode generator.
+ if(NOT CMAKE_GENERATOR STREQUAL "Xcode")
+ # Enable Whole Module Optimization by default unless the old
+ # C++ driver is being used, which behaves differently under WMO.
+ if(NOT CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
+ string(APPEND CMAKE_Swift_FLAGS_RELEASE_INIT " -wmo")
+ string(APPEND CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT " -wmo")
+ string(APPEND CMAKE_Swift_FLAGS_MINSIZEREL_INIT " -wmo")
+ endif()
+ string(APPEND CMAKE_Swift_FLAGS_DEBUG_INIT " -incremental")
endif()
endif()
+unset(__SWIFT_COMP_MODE_CMP0157)
if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
if(NOT DEFINED CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG)
@@ -104,36 +116,66 @@ endif()
cmake_initialize_per_config_variable(CMAKE_Swift_FLAGS "Swift Compiler Flags")
-# NOTE(compnerd) we do not have an object compile rule since we build the objects as part of the link step
-if(NOT CMAKE_Swift_COMPILE_OBJECT)
- set(CMAKE_Swift_COMPILE_OBJECT ":")
-endif()
-
if(NOT CMAKE_Swift_NUM_THREADS MATCHES "^[0-9]+$")
cmake_host_system_information(RESULT CMAKE_Swift_NUM_THREADS QUERY NUMBER_OF_LOGICAL_CORES)
endif()
-if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
- set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
-endif()
+# Swift split-compilation requires CMP0157 NEW policy
+if(CMAKE_Swift_COMPILATION_MODE_DEFAULT)
+ set(CMAKE_Swift_PARALLEL_FLAGS "-j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS}")
+ if(NOT CMAKE_Swift_COMPILE_OBJECT)
+ # Omit the object output. The output is controlled by the output-file-map
+ # for normal builds. For wholemodule builds, CMake appends the appropriate
+ # flags.
+ set(CMAKE_Swift_COMPILE_OBJECT "<CMAKE_Swift_COMPILER> ${CMAKE_Swift_PARALLEL_FLAGS} -c <DEFINES> <FLAGS> <INCLUDES> <SOURCE>")
+ endif()
-if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
- set(CMAKE_Swift_CREATE_SHARED_MODULE ${CMAKE_Swift_CREATE_SHARED_LIBRARY})
-endif()
+ if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
+ set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> ${CMAKE_Swift_PARALLEL_FLAGS} -emit-library <CMAKE_SHARED_LIBRARY_Swift_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <SONAME_FLAG> <TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
+ endif()
-if(NOT CMAKE_Swift_LINK_EXECUTABLE)
- set(CMAKE_Swift_LINK_EXECUTABLE "<CMAKE_Swift_COMPILER> -j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-executable -o <TARGET> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
-endif()
+ if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
+ set(CMAKE_Swift_CREATE_SHARED_MODULE ${CMAKE_Swift_CREATE_SHARED_LIBRARY})
+ endif()
-if(NOT CMAKE_Swift_LINK_EXECUTABLE_WITH_EXPORTS)
- set(CMAKE_Swift_LINK_EXECUTABLE_WITH_EXPORTS "${CMAKE_Swift_LINK_EXECUTABLE} -emit-module -emit-module-path <SWIFT_MODULE> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS}")
-endif()
+ if(NOT CMAKE_Swift_LINK_EXECUTABLE)
+ set(CMAKE_Swift_LINK_EXECUTABLE "<CMAKE_Swift_COMPILER> ${CMAKE_Swift_PARALLEL_FLAGS} -emit-executable -o <TARGET> <FLAGS> <OBJECTS> <LINK_FLAGS> <LINK_LIBRARIES>")
+ endif()
+
+ if(NOT CMAKE_Swift_CREATE_STATIC_LIBRARY)
+ set(CMAKE_Swift_CREATE_STATIC_LIBRARY "<CMAKE_Swift_COMPILER> -emit-library -static -o <TARGET> <OBJECTS> <LINK_FLAGS>")
+ set(CMAKE_Swift_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <OBJECTS>")
+ set(CMAKE_Swift_ARCHIVE_FINISH "")
+ endif()
+ unset(CMAKE_Swift_PARALLEL_FLAGS)
+else()
+ # NOTE(compnerd) we do not have an object compile rule since we build the objects as part of the link step
+ if(NOT CMAKE_Swift_COMPILE_OBJECT)
+ set(CMAKE_Swift_COMPILE_OBJECT ":")
+ endif()
+
+ if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
+ set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
+ endif()
-if(NOT CMAKE_Swift_CREATE_STATIC_LIBRARY)
- set(CMAKE_Swift_CREATE_STATIC_LIBRARY "<CMAKE_Swift_COMPILER> -j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
+ set(CMAKE_Swift_CREATE_SHARED_MODULE ${CMAKE_Swift_CREATE_SHARED_LIBRARY})
+ endif()
+
+ if(NOT CMAKE_Swift_LINK_EXECUTABLE)
+ set(CMAKE_Swift_LINK_EXECUTABLE "<CMAKE_Swift_COMPILER> -j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-executable -o <TARGET> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+ endif()
- set(CMAKE_Swift_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <OBJECTS>")
- set(CMAKE_Swift_ARCHIVE_FINISH "")
+ if(NOT CMAKE_Swift_LINK_EXECUTABLE_WITH_EXPORTS)
+ set(CMAKE_Swift_LINK_EXECUTABLE_WITH_EXPORTS "${CMAKE_Swift_LINK_EXECUTABLE} -emit-module -emit-module-path <SWIFT_MODULE> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS}")
+ endif()
+
+ if(NOT CMAKE_Swift_CREATE_STATIC_LIBRARY)
+ set(CMAKE_Swift_CREATE_STATIC_LIBRARY "<CMAKE_Swift_COMPILER> -j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
+
+ set(CMAKE_Swift_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <OBJECTS>")
+ set(CMAKE_Swift_ARCHIVE_FINISH "")
+ endif()
endif()
set(CMAKE_Swift_INFORMATION_LOADED 1)
diff --git a/Modules/CSharpUtilities.cmake b/Modules/CSharpUtilities.cmake
index dedb146..b5520ef 100644
--- a/Modules/CSharpUtilities.cmake
+++ b/Modules/CSharpUtilities.cmake
@@ -64,7 +64,7 @@ Main functions provided by the module
Sets source file properties of ``.Designer.cs`` files depending on
sibling filenames. Use this, if your CSharp target does **not**
use Windows Forms (for Windows Forms use
- :command:`csharp_set_designer_cs_properties` instead)::
+ :command:`csharp_set_windows_forms_properties` instead)::
csharp_set_designer_cs_properties([<file1> [<file2> [...]]])
diff --git a/Modules/CheckIPOSupported/main.c b/Modules/CheckIPOSupported/main.c
index 5be0864..8d2ab01 100644
--- a/Modules/CheckIPOSupported/main.c
+++ b/Modules/CheckIPOSupported/main.c
@@ -1,6 +1,6 @@
int foo();
-int main()
+int main(void)
{
return foo();
}
diff --git a/Modules/Compiler/ADSP-ASM.cmake b/Modules/Compiler/ADSP-ASM.cmake
new file mode 100644
index 0000000..9ef5142
--- /dev/null
+++ b/Modules/Compiler/ADSP-ASM.cmake
@@ -0,0 +1,6 @@
+include(Compiler/ADSP)
+__compiler_adsp(ASM)
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm)
+set(CMAKE_ASM_OUTPUT_EXTENSION ".o" )
+set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
diff --git a/Modules/Compiler/ADSP.cmake b/Modules/Compiler/ADSP.cmake
index 62566a0..39dcf39 100644
--- a/Modules/Compiler/ADSP.cmake
+++ b/Modules/Compiler/ADSP.cmake
@@ -10,6 +10,8 @@ macro(__compiler_adsp lang)
set(_CMAKE_${lang}_ADSP_FLAGS "-proc=${CMAKE_ADSP_PROCESSOR}")
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -Mo <DEP_FILE>")
+
set(CMAKE_${lang}_COMPILE_OBJECT
"<CMAKE_${lang}_COMPILER> ${_CMAKE_${lang}_ADSP_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
deleted file mode 100644
index 2265e5e..0000000
--- a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-set(_compiler_id_pp_test "defined(__COMO__)")
-
-set(_compiler_id_version_compute "
- /* __COMO_VERSION__ = VRR */
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__COMO_VERSION__ / 100)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__COMO_VERSION__ % 100)")
diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake
index 5dfb03e..452598b 100644
--- a/Modules/Compiler/GNU-Fortran.cmake
+++ b/Modules/Compiler/GNU-Fortran.cmake
@@ -17,10 +17,6 @@ endif()
set(CMAKE_Fortran_POSTPROCESS_FLAG "-fpreprocessed")
-# No -DNDEBUG for Fortran.
-string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os")
-string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3")
-
# No -isystem for Fortran because it will not find .mod files.
unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran)
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index d01054b..88c8997 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -74,36 +74,49 @@ macro(__compiler_gnu lang)
if (NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED)
## check if this feature is supported by the linker
- execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -Wl,--help
- OUTPUT_VARIABLE _linker_capabilities
- ERROR_VARIABLE _linker_capabilities)
- if(_linker_capabilities MATCHES "--dependency-file")
- set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED TRUE)
+ if (CMAKE_${lang}_COMPILER_LINKER AND CMAKE_${lang}_COMPILER_LINKER_ID MATCHES "GNU|LLD")
+ execute_process(COMMAND "${CMAKE_${lang}_COMPILER_LINKER}" --help
+ OUTPUT_VARIABLE _linker_capabilities
+ ERROR_VARIABLE _linker_capabilities)
+ if(_linker_capabilities MATCHES "--dependency-file")
+ set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED TRUE)
+ else()
+ set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE)
+ endif()
+ unset(_linker_capabilities)
else()
set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE)
endif()
- unset(_linker_capabilities)
endif()
endif()
if (CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED)
set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER TRUE)
else()
- unset(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER)
+ set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE)
endif()
- # For now, due to GNU binutils ld bug when LTO is enabled (see GNU bug
- # `30568 <https://sourceware.org/bugzilla/show_bug.cgi?id=30568>`_),
- # deactivate this feature.
- if (NOT DEFINED CMAKE_LINK_DEPENDS_USE_LINKER)
- set(CMAKE_LINK_DEPENDS_USE_LINKER FALSE)
+ # Due to GNU binutils ld bug when LTO is enabled (see GNU bug
+ # `30568 <https://sourceware.org/bugzilla/show_bug.cgi?id=30568>`_),
+ # deactivate this feature if the version is less than 2.41.
+ # For now, all known versions of gold linker have also this bug.
+ if (CMAKE_${lang}_COMPILER_LINKER_ID
+ AND (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNUgold"
+ OR (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNU"
+ AND CMAKE_${lang}_COMPILER_LINKER_VERSION VERSION_LESS "2.41")))
+ set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE)
endif()
# Initial configuration flags.
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
- string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
- string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
- string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
+ if(NOT "x${lang}" STREQUAL "xFortran")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG")
+ endif()
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
if(NOT APPLE OR NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4) # work around #4462
diff --git a/Modules/Compiler/LLVMFlang-Fortran.cmake b/Modules/Compiler/LLVMFlang-Fortran.cmake
index d27f094..0a432a9 100644
--- a/Modules/Compiler/LLVMFlang-Fortran.cmake
+++ b/Modules/Compiler/LLVMFlang-Fortran.cmake
@@ -15,6 +15,9 @@ set(CMAKE_Fortran_POSTPROCESS_FLAG "-ffixed-line-length-72")
set(CMAKE_Fortran_COMPILE_OPTIONS_TARGET "--target=")
+set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,")
+set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",")
+
if(NOT "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
diff --git a/Modules/CompilerId/VS-Intel.vfproj.in b/Modules/CompilerId/VS-Intel.vfproj.in
index 044dd20..fdd9d9d 100644
--- a/Modules/CompilerId/VS-Intel.vfproj.in
+++ b/Modules/CompilerId/VS-Intel.vfproj.in
@@ -13,7 +13,7 @@
Name="Debug|@id_platform@"
OutputDirectory="."
IntermediateDirectory="$(ConfigurationName)"
- >
+ @id_UseCompiler@>
<Tool
Name="VFFortranCompilerTool"
DebugInformationFormat="debugEnabled"
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 3ec0557..b2816a5 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1934,8 +1934,10 @@ function(_ep_get_build_command
set(args)
_ep_get_configure_command_id(${name} cfg_cmd_id)
if(cfg_cmd_id STREQUAL "cmake")
- # CMake project. Select build command based on generator.
- get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
+ # Adding a CMake project as an External Project. Select command based on generator
+ get_property(cmake_generator TARGET ${name} PROPERTY _EP_CMAKE_GENERATOR)
+ # cmake_generator is the CMake generator of the ExternalProject target being added
+ # CMAKE_GENERATOR is the CMake generator of the Current Project
if("${CMAKE_GENERATOR}" MATCHES "Make" AND
("${cmake_generator}" MATCHES "Make" OR NOT cmake_generator))
# The project uses the same Makefile generator. Use recursive make.
@@ -1948,6 +1950,11 @@ function(_ep_get_build_command
endif()
else()
# Drive the project with "cmake --build".
+ if(NOT cmake_generator)
+ # If there is no CMake Generator defined on the ExternalProject,
+ # use the same Generator as the current project
+ set(cmake_generator "${CMAKE_GENERATOR}")
+ endif()
get_target_property(cmake_command ${name} _EP_CMAKE_COMMAND)
if(cmake_command)
set(cmd "${cmake_command}")
@@ -1977,7 +1984,11 @@ function(_ep_get_build_command
list(APPEND args --config ${config})
endif()
if(step STREQUAL "INSTALL")
- list(APPEND args --target install)
+ if("${cmake_generator}" MATCHES "Green Hills MULTI")
+ list(APPEND args --target INSTALL)
+ else()
+ list(APPEND args --target install)
+ endif()
endif()
# But for "TEST" drive the project with corresponding "ctest".
if("x${step}x" STREQUAL "xTESTx")
@@ -3767,6 +3778,9 @@ function(_ep_extract_configure_command var name)
list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
else()
list(APPEND cmd "-G${CMAKE_GENERATOR}")
+ # GreenHills needs to know about the compiler and toolset.
+ # Be sure to update the similar section in
+ # FetchContent.cmake:__FetchContent_directPopulate()
if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
set(has_cmake_cache_default_args 1)
list(APPEND cmake_cache_default_args
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 77c66d1..009ca38 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -17,7 +17,7 @@ packages and/or feature for a build tree such as::
PNG, A PNG image library., <http://www.libpng.org/pub/png/>
* Enables saving screenshots
-- The following OPTIONAL packages have not been found:
- Lua51, The Lua scripting language., <http://www.lua.org>
+ Lua51, The Lua scripting language., <https://www.lua.org>
* Enables macros in MyWordProcessor
Foo, Foo provides cool stuff.
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index 9bbeac0..48cdaf4 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -195,6 +195,12 @@ Commands
still be called if :variable:`FETCHCONTENT_TRY_FIND_PACKAGE_MODE` is
set to ``OPT_IN`` or is not set.
+ It would not normally be appropriate to specify ``REQUIRED`` as one of
+ the additional arguments after ``FIND_PACKAGE_ARGS``. Doing so would
+ mean the :command:`find_package` call must succeed, so none of the other
+ details specified in the ``FetchContent_Declare()`` call would get a
+ chance to be used as a fall-back.
+
Everything after the ``FIND_PACKAGE_ARGS`` keyword is appended to the
:command:`find_package` call, so all other ``<contentOptions>`` must
come before the ``FIND_PACKAGE_ARGS`` keyword. If the
@@ -373,6 +379,10 @@ Commands
:command:`FetchContent_Declare`, the ``EXCLUDE_FROM_ALL`` keyword will
be added to the :command:`add_subdirectory` command as well.
+ .. versionadded:: 3.29
+ :variable:`CMAKE_EXPORT_FIND_PACKAGE_NAME` is set to the dependency name
+ before calling :command:`add_subdirectory`.
+
Projects should aim to declare the details of all dependencies they might
use before they call ``FetchContent_MakeAvailable()`` for any of them.
This ensures that if any of the dependencies are also sub-dependencies of
@@ -675,6 +685,17 @@ A number of cache variables can influence the behavior where details from a
any content details, turning this option ``ON`` can significantly speed up
the configure stage. It is ``OFF`` by default.
+ .. note::
+
+ The ``FETCHCONTENT_FULLY_DISCONNECTED`` variable is not an appropriate way
+ to prevent any network access on the first run in a build directory.
+ Doing so can break projects, lead to misleading error messages, and hide
+ subtle population failures. This variable is specifically intended to
+ only be turned on *after* the first time CMake has been run.
+ If you want to prevent network access even on the first run, use a
+ :ref:`dependency provider <dependency_providers>` and populate the
+ dependency from local content instead.
+
.. variable:: FETCHCONTENT_UPDATES_DISCONNECTED
This is a less severe download/update control compared to
@@ -1194,10 +1215,10 @@ function(__FetchContent_declareDetails contentName)
set(propertyName "_FetchContent_${contentNameLower}_find_package_args")
define_property(GLOBAL PROPERTY ${propertyName})
if(NOT __sawQuietKeyword)
- list(INSERT __findPackageArgs 0 QUIET)
+ string(PREPEND __findPackageArgs "QUIET ")
endif()
if(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL AND NOT __sawGlobalKeyword)
- list(APPEND __findPackageArgs GLOBAL)
+ string(APPEND __findPackageArgs " GLOBAL")
endif()
cmake_language(EVAL CODE
"set_property(GLOBAL PROPERTY ${propertyName} ${__findPackageArgs})"
@@ -1596,6 +1617,20 @@ ExternalProject_Add_Step(${contentName}-populate copyfile
list(APPEND subCMakeOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}")
endif()
+ # GreenHills needs to know about the compiler and toolset to run the
+ # subbuild commands. Be sure to update the similar section in
+ # ExternalProject.cmake:_ep_extract_configure_command()
+ if(CMAKE_GENERATOR MATCHES "Green Hills MULTI")
+ list(APPEND subCMakeOpts
+ "-DGHS_TARGET_PLATFORM:STRING=${GHS_TARGET_PLATFORM}"
+ "-DGHS_PRIMARY_TARGET:STRING=${GHS_PRIMARY_TARGET}"
+ "-DGHS_TOOLSET_ROOT:STRING=${GHS_TOOLSET_ROOT}"
+ "-DGHS_OS_ROOT:STRING=${GHS_OS_ROOT}"
+ "-DGHS_OS_DIR:STRING=${GHS_OS_DIR}"
+ "-DGHS_BSP_NAME:STRING=${GHS_BSP_NAME}"
+ )
+ endif()
+
# Override the sub-build's configuration types for multi-config generators.
# This ensures we are not affected by any custom setting from the project
# and can always request a known configuration further below.
@@ -1930,6 +1965,10 @@ macro(FetchContent_MakeAvailable)
"Trying FETCHCONTENT_MAKEAVAILABLE_SERIAL dependency provider for "
"${__cmake_contentName}"
)
+
+ list(APPEND __cmake_fcCurrentVarsStack "__fcprefix__${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+ set(CMAKE_EXPORT_FIND_PACKAGE_NAME "${__cmake_contentName}")
+
# It's still valid if there are no saved details. The project may have
# been written to assume a dependency provider is always set and will
# provide dependencies without having any declared details for them.
@@ -1947,12 +1986,12 @@ macro(FetchContent_MakeAvailable)
# This property might be defined but empty. As long as it is defined,
# find_package() can be called.
get_property(__cmake_addfpargs GLOBAL PROPERTY
- _FetchContent_${contentNameLower}_find_package_args
+ _FetchContent_${__cmake_contentNameLower}_find_package_args
DEFINED
)
if(__cmake_addfpargs)
get_property(__cmake_fpargs GLOBAL PROPERTY
- _FetchContent_${contentNameLower}_find_package_args
+ _FetchContent_${__cmake_contentNameLower}_find_package_args
)
string(APPEND __cmake_providerArgs " FIND_PACKAGE_ARGS")
foreach(__cmake_item IN LISTS __cmake_fpargs)
@@ -1984,6 +2023,12 @@ macro(FetchContent_MakeAvailable)
unset(__cmake_item)
unset(__cmake_contentDetails)
+ list(POP_BACK __cmake_fcCurrentVarsStack __cmake_original_export_find_package_name)
+ string(SUBSTRING "${__cmake_original_export_find_package_name}"
+ 12 -1 __cmake_original_export_find_package_name
+ )
+ set(CMAKE_EXPORT_FIND_PACKAGE_NAME ${__cmake_original_export_find_package_name})
+
FetchContent_GetProperties(${__cmake_contentName})
if(${__cmake_contentNameLower}_POPULATED)
continue()
@@ -2053,6 +2098,9 @@ macro(FetchContent_MakeAvailable)
endif()
if(EXISTS ${__cmake_srcdir}/CMakeLists.txt)
+ list(APPEND __cmake_fcCurrentVarsStack "__fcprefix__${CMAKE_EXPORT_FIND_PACKAGE_NAME}")
+ set(CMAKE_EXPORT_FIND_PACKAGE_NAME "${__cmake_contentName}")
+
set(__cmake_add_subdirectory_args ${__cmake_srcdir} ${${__cmake_contentNameLower}_BINARY_DIR})
if(__cmake_arg_EXCLUDE_FROM_ALL)
list(APPEND __cmake_add_subdirectory_args EXCLUDE_FROM_ALL)
@@ -2061,6 +2109,12 @@ macro(FetchContent_MakeAvailable)
list(APPEND __cmake_add_subdirectory_args SYSTEM)
endif()
add_subdirectory(${__cmake_add_subdirectory_args})
+
+ list(POP_BACK __cmake_fcCurrentVarsStack __cmake_original_export_find_package_name)
+ string(SUBSTRING "${__cmake_original_export_find_package_name}"
+ 12 -1 __cmake_original_export_find_package_name
+ )
+ set(CMAKE_EXPORT_FIND_PACKAGE_NAME ${__cmake_original_export_find_package_name})
endif()
unset(__cmake_srcdir)
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 39a1163..e9b118f 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -746,7 +746,11 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
set(_blas_openblas_lib "openblas")
if(_blas_sizeof_integer EQUAL 8)
- string(APPEND _blas_openblas_lib "64")
+ if(MINGW)
+ string(APPEND _blas_openblas_lib "_64")
+ else()
+ string(APPEND _blas_openblas_lib "64")
+ endif()
endif()
if(NOT BLAS_LIBRARIES)
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 2f33dac..5e5f1f8 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -94,8 +94,10 @@ find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_CURL QUIET libcurl)
if(PC_CURL_FOUND)
- pkg_get_variable(CURL_SUPPORTED_PROTOCOLS libcurl supported_protocols)
- pkg_get_variable(CURL_SUPPORTED_FEATURES libcurl supported_features)
+ pkg_get_variable(CURL_SUPPORTED_PROTOCOLS_STRING libcurl supported_protocols)
+ string(REPLACE " " ";" CURL_SUPPORTED_PROTOCOLS "${CURL_SUPPORTED_PROTOCOLS_STRING}")
+ pkg_get_variable(CURL_SUPPORTED_FEATURES_STRING libcurl supported_features)
+ string(REPLACE " " ";" CURL_SUPPORTED_FEATURES "${CURL_SUPPORTED_FEATURES_STRING}")
endif()
endif()
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 4d3ab5a..e142516 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -487,7 +487,11 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
set(_lapack_openblas_lib "openblas")
if(_lapack_sizeof_integer EQUAL 8)
- string(APPEND _lapack_openblas_lib "64")
+ if(MINGW)
+ string(APPEND _lapack_openblas_lib "_64")
+ else()
+ string(APPEND _lapack_openblas_lib "64")
+ endif()
endif()
check_lapack_libraries(
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 1527c31..5c4839c 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -177,9 +177,24 @@ GLVND. For non-GLVND Linux and other systems these are left undefined.
macOS-Specific
^^^^^^^^^^^^^^
-On OSX FindOpenGL defaults to using the framework version of OpenGL. People
-will have to change the cache values of OPENGL_glu_LIBRARY and
-OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX.
+On macOS this module defaults to using the macOS-native framework
+version of OpenGL. To use the X11 version of OpenGL on macOS, one
+can disable searching of frameworks. For example:
+
+.. code-block:: cmake
+
+ find_package(X11)
+ if(APPLE AND X11_FOUND)
+ set(CMAKE_FIND_FRAMEWORK NEVER)
+ find_package(OpenGL)
+ unset(CMAKE_FIND_FRAMEWORK)
+ else()
+ find_package(OpenGL)
+ endif()
+
+An end user building this project may need to point CMake at their
+X11 installation, e.g., with ``-DOpenGL_ROOT=/opt/X11``.
+
#]=======================================================================]
set(_OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY)
@@ -207,11 +222,14 @@ if (WIN32)
OPENGL_glu_LIBRARY
)
elseif (APPLE)
- # The OpenGL.framework provides both gl and glu
- find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X")
- find_library(OPENGL_glu_LIBRARY OpenGL DOC
- "GLU library for OS X (usually same as OpenGL library)")
- find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X")
+ # The OpenGL.framework provides both gl and glu in OpenGL
+ # XQuartz provides libgl and libglu
+ find_library(OPENGL_gl_LIBRARY NAMES OpenGL GL DOC
+ "OpenGL GL library")
+ find_library(OPENGL_glu_LIBRARY NAMES OpenGL GLU DOC
+ "OpenGL GLU library")
+ find_path(OPENGL_INCLUDE_DIR NAMES OpenGL/gl.h GL/gl.h DOC
+ "Include for OpenGL")
list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
list(APPEND _OpenGL_CACHE_VARS
diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake
index bc45eea..6be3422 100644
--- a/Modules/FindOpenThreads.cmake
+++ b/Modules/FindOpenThreads.cmake
@@ -5,26 +5,32 @@
FindOpenThreads
---------------
-
-
OpenThreads is a C++ based threading library. Its largest userbase
seems to OpenSceneGraph so you might notice I accept OSGDIR as an
-environment path. I consider this part of the Findosg* suite used to
+environment path. I consider this part of the ``Findosg*`` suite used to
find OpenSceneGraph components. Each component is separate and you
must opt in to each module.
-Locate OpenThreads This module defines OPENTHREADS_LIBRARY
-OPENTHREADS_FOUND, if false, do not try to link to OpenThreads
-OPENTHREADS_INCLUDE_DIR, where to find the headers
+This module defines:
+
+``OPENTHREADS_LIBRARY``
+
+``OPENTHREADS_FOUND``
+ if false, do not try to link to OpenThreads
+``OPENTHREADS_INCLUDE_DIR``
+ where to find the headers
+
+``$OPENTHREADS_DIR`` is an environment variable that would correspond to the::
+
+ ./configure --prefix=$OPENTHREADS_DIR
-$OPENTHREADS_DIR is an environment variable that would correspond to
-the ./configure --prefix=$OPENTHREADS_DIR used in building osg.
+used in building osg.
-[CMake 2.8.10]: The CMake variables OPENTHREADS_DIR or OSG_DIR can now
-be used as well to influence detection, instead of needing to specify
-an environment variable.
+.. versionadded:: 2.8.10
-Created by Eric Wing.
+ The CMake variables ``OPENTHREADS_DIR`` or ``OSG_DIR`` can now
+ be used as well to influence detection, instead of needing to specify
+ an environment variable.
#]=======================================================================]
# Header files are presumed to be included like
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index 26962df..49bc54c 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -5,15 +5,20 @@
FindPerl
--------
-Find perl
+Find a Perl interpreter.
-this module looks for Perl
+This module defines the following variables:
-::
+``PERL_EXECUTABLE``
+ The full path to Perl.
- PERL_EXECUTABLE - the full path to perl
- PERL_FOUND - If false, don't attempt to use perl.
- PERL_VERSION_STRING - version of perl found (since CMake 2.8.8)
+``PERL_FOUND``
+ True if the Perl executable was found.
+
+``PERL_VERSION_STRING``
+ .. versionadded:: 2.8.8
+
+ The version of Perl found.
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 78fa481..b42a85e 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -37,7 +37,7 @@ select a configuration):
wxWidgets_EXCLUDE_COMMON_LIBRARIES
- Set to TRUE to exclude linking of
commonly required libs (e.g., png tiff
- jpeg zlib regex expat).
+ jpeg zlib regex expat scintilla lexilla).
@@ -188,6 +188,9 @@ macro(DBG_MSG_V _MSG)
# "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
endmacro()
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
# Clear return values in case the module is loaded more than once.
set(wxWidgets_FOUND FALSE)
set(wxWidgets_INCLUDE_DIRS "")
@@ -244,8 +247,14 @@ macro(wx_extract_version)
"\\2" wxWidgets_VERSION_MINOR "${_wx_version_h}" )
string(REGEX REPLACE "^(.*\n)?#define +wxRELEASE_NUMBER +([0-9]+).*"
"\\2" wxWidgets_VERSION_PATCH "${_wx_version_h}" )
+ string(REGEX REPLACE "^(.*\n)?#define +wxSUBRELEASE_NUMBER +([0-9]+).*"
+ "\\2" wxWidgets_VERSION_TWEAK "${_wx_version_h}" )
+
set(wxWidgets_VERSION_STRING
"${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}" )
+ if(${wxWidgets_VERSION_TWEAK} GREATER 0)
+ string(APPEND wxWidgets_VERSION_STRING ".${wxWidgets_VERSION_TWEAK}")
+ endif()
dbg_msg("wxWidgets_VERSION_STRING: ${wxWidgets_VERSION_STRING}")
endmacro()
@@ -265,6 +274,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Useful common wx libs needed by almost all components.
set(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat)
+ # Libraries needed by stc component
+ set(wxWidgets_STC_LIBRARIES scintilla lexilla)
+
# DEPRECATED: Use find_package(wxWidgets COMPONENTS mono) instead.
if(NOT wxWidgets_FIND_COMPONENTS)
if(wxWidgets_USE_MONOLITHIC)
@@ -277,10 +289,15 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Add the common (usually required libs) unless
# wxWidgets_EXCLUDE_COMMON_LIBRARIES has been set.
if(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES)
- list(APPEND wxWidgets_FIND_COMPONENTS
- ${wxWidgets_COMMON_LIBRARIES})
+ if(stc IN_LIST wxWidgets_FIND_COMPONENTS)
+ list(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_STC_LIBRARIES})
+ endif()
+ list(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_COMMON_LIBRARIES})
endif()
+ # Remove duplicates, for example when user has specified common libraries.
+ list(REMOVE_DUPLICATES wxWidgets_FIND_COMPONENTS)
+
#-------------------------------------------------------------------
# WIN32: Helper MACROS
#-------------------------------------------------------------------
@@ -312,7 +329,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# FIXME: What if both regex libs are available. regex should be
# found outside the loop and only wx${LIB}${_UCD}${_DBG}.
# Find wxWidgets common libraries.
- foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla)
+ foreach(LIB ${wxWidgets_COMMON_LIBRARIES} ${wxWidgets_STC_LIBRARIES})
find_library(WX_${LIB}${_DBG}
NAMES
wx${LIB}${_UCD}${_DBG} # for regex
@@ -371,7 +388,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Clear all debug or release library paths (arguments are "d" or "").
macro(WX_CLEAR_ALL_LIBS _DBG)
# Clear wxWidgets common libraries.
- foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla)
+ foreach(LIB ${wxWidgets_COMMON_LIBRARIES} ${wxWidgets_STC_LIBRARIES})
WX_CLEAR_LIB(WX_${LIB}${_DBG})
endforeach()
@@ -441,12 +458,15 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
endif()
DBG_MSG_V("OpenGL")
- list(FIND ${_LIBS} gl WX_USE_GL)
- if(NOT WX_USE_GL EQUAL -1)
+ if(gl IN_LIST ${_LIBS})
DBG_MSG_V("- is required.")
list(APPEND wxWidgets_LIBRARIES opengl32 glu32)
endif()
+ if(stc IN_LIST ${_LIBS})
+ list(APPEND wxWidgets_LIBRARIES imm32)
+ endif()
+
list(APPEND wxWidgets_LIBRARIES winmm comctl32 uuid oleacc uxtheme rpcrt4 shlwapi version wsock32)
endmacro()
@@ -458,6 +478,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
foreach(version ${wx_versions})
foreach(patch RANGE 15 0 -1)
list(APPEND wx_paths "wxWidgets-${version}.${patch}")
+ foreach(tweak RANGE 3 1 -1)
+ list(APPEND wx_paths "wxWidgets-${version}.${patch}.${tweak}")
+ endforeach()
endforeach()
endforeach()
@@ -937,35 +960,38 @@ if(wxWidgets_FIND_STYLE STREQUAL "unix")
endif()
unset(_cygpath_exe CACHE)
endif()
-endif()
-# Check that all libraries are present, as wx-config does not check it
-set(_wx_lib_missing "")
-foreach(_wx_lib_ ${wxWidgets_LIBRARIES})
- if("${_wx_lib_}" MATCHES "^-l(.*)")
- set(_wx_lib_name "${CMAKE_MATCH_1}")
- unset(_wx_lib_found CACHE)
- find_library(_wx_lib_found NAMES ${_wx_lib_name} HINTS ${wxWidgets_LIBRARY_DIRS})
- if(_wx_lib_found STREQUAL _wx_lib_found-NOTFOUND)
- list(APPEND _wx_lib_missing ${_wx_lib_name})
- endif()
- unset(_wx_lib_found CACHE)
- endif()
-endforeach()
+ # Check that all libraries are present, as wx-config does not check it
+ set(_wx_lib_missing "")
+ foreach(_wx_lib_ ${wxWidgets_LIBRARIES})
+ if("${_wx_lib_}" MATCHES "^-l(.*)")
+ set(_wx_lib_name "${CMAKE_MATCH_1}")
+ unset(_wx_lib_found CACHE)
+ find_library(_wx_lib_found NAMES ${_wx_lib_name} HINTS ${wxWidgets_LIBRARY_DIRS})
+ if(_wx_lib_found STREQUAL _wx_lib_found-NOTFOUND)
+ list(APPEND _wx_lib_missing ${_wx_lib_name})
+ endif()
+ unset(_wx_lib_found CACHE)
+ endif()
+ endforeach()
-if (_wx_lib_missing)
- string(REPLACE ";" " " _wx_lib_missing "${_wx_lib_missing}")
- DBG_MSG_V("wxWidgets not found due to following missing libraries: ${_wx_lib_missing}")
- set(wxWidgets_FOUND FALSE)
- unset(wxWidgets_LIBRARIES)
+ if (_wx_lib_missing)
+ string(REPLACE ";" " " _wx_lib_missing "${_wx_lib_missing}")
+ DBG_MSG_V("wxWidgets not found due to following missing libraries: ${_wx_lib_missing}")
+ set(wxWidgets_FOUND FALSE)
+ unset(wxWidgets_LIBRARIES)
+ endif()
+ unset(_wx_lib_missing)
endif()
-unset(_wx_lib_missing)
# Check if a specific version was requested by find_package().
if(wxWidgets_FOUND)
wx_extract_version()
endif()
+file(TO_CMAKE_PATH "${wxWidgets_INCLUDE_DIRS}" wxWidgets_INCLUDE_DIRS)
+file(TO_CMAKE_PATH "${wxWidgets_LIBRARY_DIRS}" wxWidgets_LIBRARY_DIRS)
+
# Debug output:
DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}")
DBG_MSG("wxWidgets_INCLUDE_DIRS : ${wxWidgets_INCLUDE_DIRS}")
@@ -1215,3 +1241,5 @@ function(WXWIDGETS_ADD_RESOURCES _outfiles)
set(${_outfiles} ${${_outfiles}} PARENT_SCOPE)
endfunction()
+
+cmake_policy(POP)
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index 57a7476..3c12e14 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -500,7 +500,7 @@ function(gtest_discover_tests TARGET)
-D "CTEST_FILE=${ctest_tests_file}"
-D "TEST_DISCOVERY_TIMEOUT=${_DISCOVERY_TIMEOUT}"
-D "TEST_XML_OUTPUT_DIR=${_XML_OUTPUT_DIR}"
- -P "${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}"
+ -P "${CMAKE_ROOT}/Modules/GoogleTestAddTests.cmake"
VERBATIM
)
@@ -526,7 +526,7 @@ function(gtest_discover_tests TARGET)
" if(NOT EXISTS \"${ctest_tests_file}\" OR" "\n"
" NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"$<TARGET_FILE:${TARGET}>\" OR\n"
" NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"\${CMAKE_CURRENT_LIST_FILE}\")\n"
- " include(\"${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}\")" "\n"
+ " include(\"${CMAKE_ROOT}/Modules/GoogleTestAddTests.cmake\")" "\n"
" gtest_discover_tests_impl(" "\n"
" TEST_EXECUTABLE" " [==[" "$<TARGET_FILE:${TARGET}>" "]==]" "\n"
" TEST_EXECUTOR" " [==[" "${crosscompiling_emulator}" "]==]" "\n"
@@ -573,9 +573,5 @@ endfunction()
###############################################################################
-set(_GOOGLETEST_DISCOVER_TESTS_SCRIPT
- ${CMAKE_CURRENT_LIST_DIR}/GoogleTestAddTests.cmake
-)
-
# Restore project's policies
cmake_policy(POP)
diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake
index de0f7d6..eea267d 100644
--- a/Modules/GoogleTestAddTests.cmake
+++ b/Modules/GoogleTestAddTests.cmake
@@ -112,6 +112,7 @@ function(gtest_discover_tests_impl)
message(FATAL_ERROR
"Error running test executable.\n"
" Path: '${path}'\n"
+ " Working directory: '${_TEST_WORKING_DIR}'\n"
" Result: ${result}\n"
" Output:\n"
" ${output}\n"
diff --git a/Modules/Internal/AppleArchitectureSelection.cmake.in b/Modules/Internal/AppleArchitectureSelection.cmake.in
new file mode 100644
index 0000000..fec0d41
--- /dev/null
+++ b/Modules/Internal/AppleArchitectureSelection.cmake.in
@@ -0,0 +1,8 @@
+@PACKAGE_INIT@
+
+if(NOT CMAKE_OSX_ARCHITECTURES)
+ message(FATAL_ERROR "CMAKE_OSX_ARCHITECTURES must be explicitly set for this package")
+endif()
+@_branch_code@
+
+message(FATAL_ERROR "Architecture not supported")
diff --git a/Modules/Internal/ApplePlatformSelection.cmake.in b/Modules/Internal/ApplePlatformSelection.cmake.in
new file mode 100644
index 0000000..493d650
--- /dev/null
+++ b/Modules/Internal/ApplePlatformSelection.cmake.in
@@ -0,0 +1,24 @@
+@PACKAGE_INIT@
+
+string(TOLOWER "${CMAKE_OSX_SYSROOT}" _CMAKE_OSX_SYSROOT_LOWER)
+if(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)iphonesimulator")
+ @_branch_IOS_SIMULATOR_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)iphoneos")
+ @_branch_IOS_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)appletvsimulator")
+ @_branch_TVOS_SIMULATOR_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)appletvos")
+ @_branch_TVOS_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)watchsimulator")
+ @_branch_WATCHOS_SIMULATOR_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)watchos")
+ @_branch_WATCHOS_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)xrsimulator")
+ @_branch_VISIONOS_SIMULATOR_CONFIG_FILE@
+elseif(_CMAKE_OSX_SYSROOT_LOWER MATCHES "(^|/)xros")
+ @_branch_VISIONOS_CONFIG_FILE@
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ @_branch_MACOS_CONFIG_FILE@
+else()
+ message(FATAL_ERROR "Platform not supported")
+endif()
diff --git a/Modules/Internal/CMakeDetermineLinkerId.cmake b/Modules/Internal/CMakeDetermineLinkerId.cmake
new file mode 100644
index 0000000..05c83d2
--- /dev/null
+++ b/Modules/Internal/CMakeDetermineLinkerId.cmake
@@ -0,0 +1,104 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# Function to identify the linker. This is used internally by CMake and should
+# not be included by user code.
+# If successful, sets CMAKE_<lang>_COMPILER_LINKER_ID and
+# CMAKE_<lang>_COMPILER_LINKER_VERSION
+
+cmake_policy(PUSH)
+cmake_policy(SET CMP0053 NEW)
+cmake_policy(SET CMP0054 NEW)
+
+function(cmake_determine_linker_id lang linker)
+ if (NOT linker)
+ # linker was not identified
+ unset(CMAKE_${lang}_COMPILER_LINKER_ID PARENT_SCOPE)
+ unset(CMAKE_${lang}_COMPILER_LINKER_VERSION PARENT_SCOPE)
+ unset(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT PARENT_SCOPE)
+ return()
+ endif()
+
+ set(linker_id)
+ set(linker_frontend)
+ set(linker_version)
+
+ # Compute the linker ID and version.
+ foreach(flags IN ITEMS
+ "-v" # AppleClang, GNU, GNUgold, MOLD
+ "-V" # AIX, Solaris
+ "--version" # LLD
+ )
+ execute_process(COMMAND "${linker}" ${flags}
+ OUTPUT_VARIABLE linker_desc
+ ERROR_VARIABLE linker_desc
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_STRIP_TRAILING_WHITESPACE)
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND linker_desc MATCHES "@\\(#\\)PROGRAM:ld.+PROJECT:[a-z0-9]+-([0-9.]+).+")
+ set(linker_id "AppleClang")
+ set(linker_frontend "GNU")
+ set(linker_version "${CMAKE_MATCH_1}")
+ break()
+ elseif(linker_desc MATCHES "mold \\(sold\\) ([0-9.]+)")
+ set(linker_id "MOLD")
+ set(linker_frontend "GNU")
+ set(linker_version "${CMAKE_MATCH_1}")
+ break()
+ elseif(linker_desc MATCHES "mold ([0-9.]+)")
+ set(linker_id "MOLD")
+ set(linker_frontend "GNU")
+ set(linker_version "${CMAKE_MATCH_1}")
+ break()
+ elseif(linker_desc MATCHES "LLD ([0-9.]+)")
+ set(linker_id "LLD")
+ set(linker_frontend "GNU")
+ set(linker_version "${CMAKE_MATCH_1}")
+ if(WIN32 AND NOT linker_desc MATCHES "compatible with GNU")
+ set(linker_frontend "MSVC")
+ endif()
+ break()
+ elseif(linker_desc MATCHES "GNU ld \\([^)]+\\) ([0-9.]+)")
+ set(linker_id "GNU")
+ set(linker_frontend "GNU")
+ set(linker_version "${CMAKE_MATCH_1}")
+ break()
+ elseif(linker_desc MATCHES "GNU gold \\([^)]+\\) ([0-9.]+)")
+ set(linker_id "GNUgold")
+ set(linker_frontend "GNU")
+ set(linker_version "${CMAKE_MATCH_1}")
+ break()
+ elseif(linker_desc MATCHES "Microsoft \\(R\\) Incremental Linker Version ([0-9.]+)")
+ set(linker_id "MSVC")
+ set(linker_frontend "MSVC")
+ set(linker_version "${CMAKE_MATCH_1}")
+ break()
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND linker_desc MATCHES "Solaris Link Editors: ([0-9.-]+)")
+ set(linker_id "Solaris")
+ set(linker_version "${CMAKE_MATCH_1}")
+ break()
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "AIX" AND linker_desc MATCHES " LD ([0-9.]+)")
+ set(linker_id "AIX")
+ set(linker_version "${CMAKE_MATCH_1}")
+ break()
+ endif()
+ endforeach()
+ if(NOT linker_id)
+ # unknown linker
+ set(linker_id "UNKNOWN")
+ endif()
+
+ set(CMAKE_${lang}_COMPILER_LINKER_ID "${linker_id}" PARENT_SCOPE)
+ if (linker_frontend)
+ set(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT "${linker_frontend}" PARENT_SCOPE)
+ else()
+ unset(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT PARENT_SCOPE)
+ endif()
+ if (linker_version)
+ set(CMAKE_${lang}_COMPILER_LINKER_VERSION "${linker_version}" PARENT_SCOPE)
+ else()
+ unset(CMAKE_${lang}_COMPILER_LINKER_VERSION PARENT_SCOPE)
+ endif()
+endfunction()
+
+cmake_policy(POP)
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index 38e32c2..55a621c 100644
--- a/Modules/Internal/CPack/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -710,7 +710,7 @@ function(cpack_deb_prepare_package_vars)
"${CPACK_DEBIAN_PACKAGE_NAME}-dbgsym_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.ddeb")
else()
if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)")
- message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!")
+ set(CPACK_DEBIAN_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}.deb")
endif()
set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}")
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index ace2c6b..85c0a93 100644
--- a/Modules/Internal/CPack/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -1577,7 +1577,7 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
if(CPACK_RPM_FILE_NAME)
if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm")
- message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!")
+ set(CPACK_RPM_FILE_NAME "${CPACK_RPM_FILE_NAME}.rpm")
endif()
else()
# old file name format for back compatibility
diff --git a/Modules/Internal/CPack/CPackWIX.cmake b/Modules/Internal/CPack/CPackWIX.cmake
index d1875f2..5fe772e 100644
--- a/Modules/Internal/CPack/CPackWIX.cmake
+++ b/Modules/Internal/CPack/CPackWIX.cmake
@@ -18,3 +18,7 @@ find_program(CPACK_WIX_LIGHT_EXECUTABLE light
if(NOT CPACK_WIX_LIGHT_EXECUTABLE)
message(FATAL_ERROR "Could not find the WiX light executable.")
endif()
+
+if(NOT DEFINED CPACK_WIX_INSTALL_SCOPE)
+ set(CPACK_WIX_INSTALL_SCOPE "perMachine")
+endif()
diff --git a/Modules/Internal/CPack/WIX.template.in b/Modules/Internal/CPack/WIX.template.in
index c0bf935..fdd8278 100644
--- a/Modules/Internal/CPack/WIX.template.in
+++ b/Modules/Internal/CPack/WIX.template.in
@@ -12,7 +12,12 @@
Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
+
+ <?if $(var.CPACK_WIX_INSTALL_SCOPE) = "NONE" ?>
<Package InstallerVersion="301" Compressed="yes"/>
+ <?else?>
+ <Package InstallerVersion="301" Compressed="yes" InstallScope="$(var.CPACK_WIX_INSTALL_SCOPE)"/>
+ <?endif?>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
diff --git a/Modules/Platform/ADSP-Common.cmake b/Modules/Platform/ADSP-Common.cmake
index 2ba90b2..7ec8a6f 100644
--- a/Modules/Platform/ADSP-Common.cmake
+++ b/Modules/Platform/ADSP-Common.cmake
@@ -9,9 +9,9 @@ macro(__platform_adsp_init)
set(CMAKE_ADSP_PROCESSOR "ADSP-${CMAKE_SYSTEM_PROCESSOR}")
string(TOUPPER "${CMAKE_ADSP_PROCESSOR}" CMAKE_ADSP_PROCESSOR)
- set(CMAKE_ADSP_COMPILER_NAME cc21k.exe)
+ set(CMAKE_ADSP_COMPILER_NAME "cc21k${CMAKE_EXECUTABLE_SUFFIX}")
if(CMAKE_ADSP_PROCESSOR MATCHES "^ADSP-BF")
- set(CMAKE_ADSP_COMPILER_NAME ccblkfn.exe)
+ set(CMAKE_ADSP_COMPILER_NAME "ccblkfn${CMAKE_EXECUTABLE_SUFFIX}")
endif()
set(CMAKE_ADSP_PLATFORM_INITIALIZED TRUE)
@@ -20,7 +20,12 @@ endmacro()
macro(__platform_adsp lang)
__platform_adsp_init()
- set(CMAKE_${lang}_COMPILER "${CMAKE_ADSP_ROOT}/${CMAKE_ADSP_COMPILER_NAME}")
+ find_program(
+ CMAKE_${lang}_COMPILER
+ "${CMAKE_ADSP_COMPILER_NAME}"
+ PATHS "${CMAKE_ADSP_ROOT}"
+ REQUIRED
+ )
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}" "-proc=${CMAKE_ADSP_PROCESSOR}" "-version"
diff --git a/Modules/Platform/ADSP-Determine.cmake b/Modules/Platform/ADSP-Determine.cmake
index 6ccf1ea..1588c92 100644
--- a/Modules/Platform/ADSP-Determine.cmake
+++ b/Modules/Platform/ADSP-Determine.cmake
@@ -21,6 +21,6 @@ endif()
if(NOT CMAKE_ADSP_ROOT)
_find_adsp_root("C:/Program Files (x86)/Analog Devices/VisualDSP *")
endif()
-if(NOT IS_DIRECTORY "${CMAKE_ADSP_ROOT}")
- message(FATAL_ERROR "ADSP: could not find CCES/VDSP++ install directory ${CMAKE_ADSP_ROOT}")
+if(NOT CMAKE_ADSP_ROOT)
+ _find_adsp_root("/opt/analog/cces *")
endif()
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
index a9aa8e0..55a6680 100644
--- a/Modules/Platform/AIX-GNU.cmake
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -14,8 +14,11 @@ macro(__aix_compiler_gnu lang)
string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-bnoipath")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL)
+
if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 7 OR CMAKE_SYSTEM_VERSION VERSION_LESS 7.1)
unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
endif()
diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake
index 902cbb3..c225de9 100644
--- a/Modules/Platform/AIX-XL.cmake
+++ b/Modules/Platform/AIX-XL.cmake
@@ -17,6 +17,7 @@ macro(__aix_compiler_xl lang)
set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ")
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL)
set(_OBJECTS " <OBJECTS>")
if(DEFINED CMAKE_XL_CreateExportList AND CMAKE_XL_CreateExportList STREQUAL "")
diff --git a/Modules/Platform/Apple-Clang.cmake b/Modules/Platform/Apple-Clang.cmake
index 57b3910..7986a37 100644
--- a/Modules/Platform/Apple-Clang.cmake
+++ b/Modules/Platform/Apple-Clang.cmake
@@ -15,9 +15,18 @@ macro(__apple_compiler_clang lang)
set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
endif()
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE UNICITY=ALL)
+
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "-framework <LIBRARY>")
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "-fuse-ld=ld")
+ set(CMAKE_${lang}_USING_LINKER_APPLE_CLASSIC "-fuse-ld=ld" "LINKER:-ld_classic")
+ set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
+ set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
+ set(CMAKE_${lang}_USING_LINKER_SOLD "-fuse-ld=sold")
+
if(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneOS")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-miphoneos-version-min=")
elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneSimulator")
diff --git a/Modules/Platform/Apple-GNU.cmake b/Modules/Platform/Apple-GNU.cmake
index 823c790..15f6a71 100644
--- a/Modules/Platform/Apple-GNU.cmake
+++ b/Modules/Platform/Apple-GNU.cmake
@@ -17,6 +17,9 @@ macro(__apple_compiler_gnu lang)
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "-framework <LIBRARY>")
set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE)
+
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
+ set(CMAKE_${lang}_USING_LINKER_APPLE_CLASSIC "LINKER:-ld_classic")
endmacro()
macro(cmake_gnu_set_sysroot_flag lang)
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index ef64012..070b24d 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -52,6 +52,8 @@ macro(__cygwin_compiler_gnu lang)
"<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
set(CMAKE_${lang}_CREATE_WIN32_EXE "-mwindows")
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
+
# No -fPIC on cygwin
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index d614182..533b9ce 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -125,17 +125,17 @@ set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,<LIBRARY>")
set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE)
# Defines LINK_LIBRARY features for libraries
-set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY "PATH{LINKER:-needed_library <LIBRARY>}NAME{LINKER:-needed-l<LIBRARY>}")
+set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY "PATH{LINKER:-needed_library,<LIBRARY>}NAME{LINKER:-needed-l<LIBRARY>}")
set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY_SUPPORTED TRUE)
-set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY "PATH{LINKER:-reexport_library <LIBRARY>}NAME{LINKER:-reexport-l<LIBRARY>}")
+set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY "PATH{LINKER:-reexport_library,<LIBRARY>}NAME{LINKER:-reexport-l<LIBRARY>}")
set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY_SUPPORTED TRUE)
-set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library <LIBRARY>}NAME{LINKER:-weak-l<LIBRARY>}")
+set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library,<LIBRARY>}NAME{LINKER:-weak-l<LIBRARY>}")
set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY_SUPPORTED TRUE)
# Defines LINK_LIBRARY feature to Force loading of all members of an archive
-set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load <LIB_ITEM>")
+set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load,<LIB_ITEM>")
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
# default to searching for frameworks first
diff --git a/Modules/Platform/Linux-Clang-CUDA.cmake b/Modules/Platform/Linux-Clang-CUDA.cmake
new file mode 100644
index 0000000..4a9337e
--- /dev/null
+++ b/Modules/Platform/Linux-Clang-CUDA.cmake
@@ -0,0 +1,2 @@
+include(Platform/Linux-GNU)
+__linux_compiler_gnu(CUDA)
diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake
index 6878254..c3878eb 100644
--- a/Modules/Platform/Linux-GNU.cmake
+++ b/Modules/Platform/Linux-GNU.cmake
@@ -12,4 +12,13 @@ macro(__linux_compiler_gnu lang)
# We pass this for historical reasons. Projects may have
# executables that use dlopen but do not set ENABLE_EXPORTS.
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
+
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
+
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
+ set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
+ set(CMAKE_${lang}_USING_LINKER_BFD "-fuse-ld=bfd")
+ set(CMAKE_${lang}_USING_LINKER_GOLD "-fuse-ld=gold")
+ set(CMAKE_${lang}_USING_LINKER_MOLD "-fuse-ld=mold")
endmacro()
diff --git a/Modules/Platform/Linux-LLVMFlang-Fortran.cmake b/Modules/Platform/Linux-LLVMFlang-Fortran.cmake
new file mode 100644
index 0000000..ceecc2f
--- /dev/null
+++ b/Modules/Platform/Linux-LLVMFlang-Fortran.cmake
@@ -0,0 +1 @@
+include(Platform/Linux-GNU-Fortran)
diff --git a/Modules/Platform/Linux-NVIDIA-CUDA.cmake b/Modules/Platform/Linux-NVIDIA-CUDA.cmake
new file mode 100644
index 0000000..f383720
--- /dev/null
+++ b/Modules/Platform/Linux-NVIDIA-CUDA.cmake
@@ -0,0 +1,9 @@
+
+set(CMAKE_CUDA_VERBOSE_LINK_FLAG "-Wl,-v")
+
+# linker selection
+set(CMAKE_CUDA_USING_LINKER_SYSTEM "")
+set(CMAKE_CUDA_USING_LINKER_LLD "-fuse-ld=lld")
+set(CMAKE_CUDA_USING_LINKER_BFD "-fuse-ld=bfd")
+set(CMAKE_CUDA_USING_LINKER_GOLD "-fuse-ld=gold")
+set(CMAKE_CUDA_USING_LINKER_MOLD "-fuse-ld=mold")
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 33d271d..f081f42 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -45,6 +45,7 @@ macro(__windows_compiler_clang_gnu lang)
math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}")
endif()
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-v")
# No -fPIC on Windows
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
@@ -53,6 +54,14 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_${lang}_LINK_OPTIONS_NO_PIE "")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD UNICITY=ALL)
+
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_DEFAULT "-fuse-ld=lld-link")
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "-fuse-ld=link")
+ set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld-link")
+ set(CMAKE_${lang}_USING_LINKER_MSVC "-fuse-ld=link")
+
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
@@ -74,10 +83,10 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
- "<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} -Xlinker /MANIFEST:EMBED -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <OBJECTS> <LINK_LIBRARIES> <MANIFESTS>")
+ "<CMAKE_${lang}_COMPILER> -nostartfiles -nostdlib <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} -Xlinker /MANIFEST:EMBED -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <OBJECTS> <LINK_LIBRARIES> <MANIFESTS>")
set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
set(CMAKE_${lang}_LINK_EXECUTABLE
- "<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /MANIFEST:EMBED -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES> <MANIFESTS>")
+ "<CMAKE_${lang}_COMPILER> -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /MANIFEST:EMBED -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES> <MANIFESTS>")
set(CMAKE_${lang}_CREATE_WIN32_EXE "-Xlinker /subsystem:windows")
set(CMAKE_${lang}_CREATE_CONSOLE_EXE "-Xlinker /subsystem:console")
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 412af6b..9f81882 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -112,6 +112,13 @@ macro(__windows_compiler_gnu lang)
set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
endforeach()
+ set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v")
+
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "")
+ set(CMAKE_${lang}_USING_LINKER_BFD "-fuse-ld=bfd")
+ set(CMAKE_${lang}_USING_LINKER_LLD "-fuse-ld=lld")
+
# No -fPIC on Windows
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
diff --git a/Modules/Platform/Windows-LLVMFlang-Fortran.cmake b/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
index 57e36c6..10e3b2c 100644
--- a/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
+++ b/Modules/Platform/Windows-LLVMFlang-Fortran.cmake
@@ -5,17 +5,22 @@ elseif("x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
include(Platform/Windows-MSVC)
__windows_compiler_msvc(Fortran)
- # FIXME(LLVMFlang): It does not provides MSVC runtime library selection flags.
- # It should be given a flag like classic Flang's `-Xclang --dependent-lib=`, or a
- # dedicated flag to select among multiple `Fortran*.lib` runtime library variants
- # that each depend on a different MSVC runtime library. For now, LLVMFlang's
- # `Fortran*.lib` runtime libraries hard-code use of msvcrt (MultiThreadedDLL),
- # so we link to it ourselves.
- set(_LLVMFlang_LINK_RUNTIME "-defaultlib:msvcrt")
- set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
- set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
- set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
- set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
+ if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0)
+ set(_LLVMFlang_LINK_RUNTIME "")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "-fms-runtime-lib=static")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "-fms-runtime-lib=dll")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "-fms-runtime-lib=static_dbg")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "-fms-runtime-lib=dll_dbg")
+ else()
+ # LLVMFlang < 18.0 does not have MSVC runtime library selection flags.
+ # The official distrubtion's `Fortran*.lib` runtime libraries hard-code
+ # use of msvcrt (MultiThreadedDLL), so we link to it ourselves.
+ set(_LLVMFlang_LINK_RUNTIME "-defaultlib:msvcrt")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
+ set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
+ endif()
# LLVMFlang, like Clang, does not provide all debug information format flags.
# In order to provide easy integration with C and C++ projects that use the
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 829ab9b..48e7c4e 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -512,6 +512,14 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_DEPFILE_FLAGS_${lang} "/showIncludes")
set(CMAKE_${lang}_DEPFILE_FORMAT msvc)
endif()
+
+ set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD UNICITY=ALL)
+
+ # linker selection
+ set(CMAKE_${lang}_USING_LINKER_SYSTEM "${CMAKE_LINKER_LINK}")
+ set(CMAKE_${lang}_USING_LINKER_LLD "${CMAKE_LINKER_LLD}")
+ set(CMAKE_${lang}_USING_LINKER_MSVC "${CMAKE_LINKER_LINK}")
+ set(CMAKE_${lang}_USING_LINKER_MODE TOOL)
endmacro()
macro(__windows_compiler_msvc_enable_rc flags)
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index 326e715..6489841 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -47,6 +47,12 @@ set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICIT_DLINK_FLAGS}")
unset(__IMPLICIT_DLINK_FLAGS)
+# linker selection
+set(CMAKE_CUDA_USING_LINKER_SYSTEM "${CMAKE_LINKER_LINK}")
+set(CMAKE_CUDA_USING_LINKER_LLD "${CMAKE_LINKER_LLD}")
+set(CMAKE_CUDA_USING_LINKER_MSVC "${CMAKE_LINKER_LINK}")
+set(CMAKE_CUDA_USING_LINKER_MODE TOOL)
+
string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}")
if(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT)
diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake
index 1bf39cf..bc93caa 100644
--- a/Modules/Platform/Windows.cmake
+++ b/Modules/Platform/Windows.cmake
@@ -14,7 +14,10 @@ set(CMAKE_DL_LIBS "")
set(CMAKE_EXTRA_LINK_EXTENSIONS ".targets")
set(CMAKE_FIND_LIBRARY_PREFIXES "")
-set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
+set(CMAKE_FIND_LIBRARY_SUFFIXES
+ ".dll.lib" # import library from Rust toolchain for MSVC ABI
+ ".lib" # static or import library from MSVC tooling
+ )
# for borland make long command lines are redirected to a file
# with the following syntax, see Windows-bcc32.cmake for use
diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake
index 83c9b20..5e6f606 100644
--- a/Modules/UseEcos.cmake
+++ b/Modules/UseEcos.cmake
@@ -8,21 +8,31 @@ UseEcos
This module defines variables and macros required to build eCos application.
This file contains the following macros:
-ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs
-ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an eCos
-executable ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN ) - adjusts
-the path of the source files and puts the result into VAR
-
-Macros for selecting the toolchain: ECOS_USE_ARM_ELF_TOOLS() - enable
-the ARM ELF toolchain for the directory where it is called
-ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF toolchain for the
-directory where it is called ECOS_USE_PPC_EABI_TOOLS() - enable the
-PowerPC toolchain for the directory where it is called
-
-It contains the following variables: ECOS_DEFINITIONS
-ECOSCONFIG_EXECUTABLE ECOS_CONFIG_FILE - defaults to ecos.ecc, if your
-eCos configuration file has a different name, adjust this variable for
-internal use only:
+
+``ECOS_ADD_INCLUDE_DIRECTORIES()``
+ add the eCos include dirs
+``ECOS_ADD_EXECUTABLE(name source1 ... sourceN )``
+ create an eCos executable
+``ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN )``
+ adjusts the path of the source files and puts the result into ``VAR``
+
+Macros for selecting the toolchain:
+
+``ECOS_USE_ARM_ELF_TOOLS()``
+ enable the ARM ELF toolchain for the directory where it is called
+``ECOS_USE_I386_ELF_TOOLS()``
+ enable the i386 ELF toolchain for the directory where it is called
+``ECOS_USE_PPC_EABI_TOOLS()``
+ enable the PowerPC toolchain for the directory where it is called
+
+It contains the following variables:
+
+``ECOS_DEFINITIONS``
+
+``ECOSCONFIG_EXECUTABLE``
+
+``ECOS_CONFIG_FILE``
+ defaults to ecos.ecc, if your eCos configuration file has a different name, adjust this variable for internal use only:
::
diff --git a/Modules/UseJava/javaTargets.cmake.in b/Modules/UseJava/javaTargets.cmake.in
index 6e14256..f3670c2 100644
--- a/Modules/UseJava/javaTargets.cmake.in
+++ b/Modules/UseJava/javaTargets.cmake.in
@@ -1,6 +1,5 @@
-cmake_minimum_required(VERSION 2.8.12)
cmake_policy(PUSH)
-cmake_policy(VERSION 2.8)
+cmake_policy(VERSION 2.8.12...3.27)
#----------------------------------------------------------------
# Generated CMake Java target import file.
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index cece973..f264fb6 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -657,7 +657,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
if(NOT ("-dllimport" IN_LIST swig_source_file_flags OR "-dllimport" IN_LIST SWIG_MODULE_${name}_EXTRA_FLAGS))
# This makes sure that the name used in the generated DllImport
# matches the library name created by CMake
- list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "$<TARGET_FILE_PREFIX:${target_name}>$<TARGET_FILE_BASE_NAME:${target_name}>")
+ list (APPEND SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport" "$<TARGET_FILE_BASE_NAME:${target_name}>")
endif()
endif()
if (SWIG_MODULE_${name}_LANGUAGE STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY)