diff options
296 files changed, 2378 insertions, 314 deletions
diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake index 5511930..4907a28 100644 --- a/Modules/CMakeCommonLanguageInclude.cmake +++ b/Modules/CMakeCommonLanguageInclude.cmake @@ -120,13 +120,4 @@ macro(_cmake_common_language_platform_flags lang) ${CMAKE_${type}_LINK_DYNAMIC_C_FLAGS}) endif() endforeach() - - if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") - if(NOT DEFINED CMAKE_${lang}_LINK_WHAT_YOU_USE_FLAG) - set(CMAKE_${lang}_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed") - endif() - if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK) - set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r) - endif() - endif() endmacro() diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 64420b3..f1b9e89 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -34,6 +34,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj endif() endfunction() +# FIXME(#26157) linker for Intel legacy compilers is not identified function(cmake_parse_implicit_link_info2 text log_var obj_regex) set(implicit_libs_tmp "") set(implicit_objs_tmp "") diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index 60df6a2..c495dd9 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -108,15 +108,6 @@ else() endif() unset(__SWIFT_COMP_MODE_CMP0157) -if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") - if(NOT DEFINED CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG) - set(CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed") - endif() - if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK) - set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r) - endif() -endif() - cmake_initialize_per_config_variable(CMAKE_Swift_FLAGS "Swift Compiler Flags") if(NOT CMAKE_Swift_NUM_THREADS MATCHES "^[0-9]+$") diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 3f705a9..83c818d 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -52,60 +52,6 @@ macro(__compiler_gnu lang) set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") endif() - # define flags for linker depfile generation - set(CMAKE_${lang}_LINKER_DEPFILE_FLAGS "LINKER:--dependency-file,<DEP_FILE>") - set(CMAKE_${lang}_LINKER_DEPFILE_FORMAT gcc) - - if(NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) - ## Ensure ninja tool is recent enough... - if(CMAKE_GENERATOR MATCHES "^Ninja") - # Ninja 1.10 or upper is required - execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" --version - OUTPUT_VARIABLE _ninja_version - ERROR_VARIABLE _ninja_version) - if (_ninja_version MATCHES "[0-9]+(\\.[0-9]+)*") - set (_ninja_version "${CMAKE_MATCH_0}") - endif() - if (_ninja_version VERSION_LESS "1.10") - set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE) - endif() - unset(_ninja_version) - endif() - - if (NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) - ## check if this feature is supported by the linker - 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() - endif() - endif() - if (CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) - set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER TRUE) - else() - set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE) - endif() - - # 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") diff --git a/Modules/ExternalProject/shared_internal_commands.cmake b/Modules/ExternalProject/shared_internal_commands.cmake index 59c5f8c..69b5ad8 100644 --- a/Modules/ExternalProject/shared_internal_commands.cmake +++ b/Modules/ExternalProject/shared_internal_commands.cmake @@ -898,41 +898,33 @@ function(_ep_add_download_command name) message(FATAL_ERROR "error: could not find svn for checkout of ${name}") endif() - set(svn_revision "${_EP_SVN_REVISION}") - set(svn_username "${_EP_SVN_USERNAME}") - set(svn_password "${_EP_SVN_PASSWORD}") set(svn_trust_cert "${_EP_SVN_TRUST_CERT}") set(uses_terminal "${_EP_USES_TERMINAL_DOWNLOAD}") - # The --trust-server-cert option requires --non-interactive - if(uses_terminal AND NOT svn_trust_cert) - set(svn_interactive_args "") - else() - set(svn_interactive_args "--non-interactive") - endif() get_filename_component(src_name "${source_dir}" NAME) get_filename_component(work_dir "${source_dir}" PATH) set(comment "Performing download step (SVN checkout) for '${name}'") - set(svn_user_pw_args "") - if(DEFINED _EP_SVN_USERNAME) - set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}") - endif() - if(DEFINED _EP_SVN_PASSWORD) - set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}") - endif() - if(svn_trust_cert) - set(svn_trust_cert_args --trust-server-cert) - endif() set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} - ${svn_revision} - ${svn_interactive_args} - ${svn_trust_cert_args} - ${svn_user_pw_args} - ${src_name} + ${_EP_SVN_REVISION} ) + # The --trust-server-cert option requires --non-interactive + if(svn_trust_cert OR NOT uses_terminal) + list(APPEND cmd "--non-interactive") + endif() + if(svn_trust_cert) + list(APPEND cmd "--trust-server-cert") + endif() + if(DEFINED _EP_SVN_USERNAME) + list(APPEND cmd "--username=${_EP_SVN_USERNAME}") + endif() + if(DEFINED _EP_SVN_PASSWORD) + list(APPEND cmd "--password=${_EP_SVN_PASSWORD}") + endif() + list(APPEND cmd ${src_name}) + if(arg_SCRIPT_FILE) _ep_add_script_commands( step_script_contents @@ -1485,35 +1477,26 @@ function(_ep_add_update_command name) endif() set(work_dir ${source_dir}) set(comment "Performing update step (SVN update) for '${name}'") - set(svn_revision "${_EP_SVN_REVISION}") - set(svn_username "${_EP_SVN_USERNAME}") - set(svn_password "${_EP_SVN_PASSWORD}") set(svn_trust_cert "${_EP_SVN_TRUST_CERT}") set(uses_terminal "${_EP_USES_TERMINAL_UPDATE}") + set(cmd + ${Subversion_SVN_EXECUTABLE} + up + ${_EP_SVN_REVISION} + ) # The --trust-server-cert option requires --non-interactive - if(uses_terminal AND NOT svn_trust_cert) - set(svn_interactive_args "") - else() - set(svn_interactive_args "--non-interactive") + if(svn_trust_cert OR NOT uses_terminal) + list(APPEND cmd "--non-interactive") endif() - set(svn_user_pw_args "") - if(DEFINED svn_username) - set(svn_user_pw_args ${svn_user_pw_args} "--username=${svn_username}") + if(svn_trust_cert) + list(APPEND cmd --trust-server-cert) endif() - if(DEFINED svn_password) - set(svn_user_pw_args ${svn_user_pw_args} "--password=${svn_password}") + if(DEFINED _EP_SVN_USERNAME) + list(APPEND cmd "--username=${_EP_SVN_USERNAME}") endif() - if(svn_trust_cert) - set(svn_trust_cert_args --trust-server-cert) + if(DEFINED _EP_SVN_PASSWORD) + list(APPEND cmd "--password=${_EP_SVN_PASSWORD}") endif() - set(cmd - ${Subversion_SVN_EXECUTABLE} - up - ${svn_revision} - ${svn_interactive_args} - ${svn_trust_cert_args} - ${svn_user_pw_args} - ) set(always 1) if(arg_SCRIPT_FILE) diff --git a/Modules/Internal/CMakeASM-ATTLinkerInformation.cmake b/Modules/Internal/CMakeASM-ATTLinkerInformation.cmake new file mode 100644 index 0000000..5e3ae78 --- /dev/null +++ b/Modules/Internal/CMakeASM-ATTLinkerInformation.cmake @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# support for AT&T syntax assemblers, e.g. GNU as + +# Load the generic ASMInformation file: +set(ASM_DIALECT "-ATT") +include(Internal/CMakeASMLinkerInformation) +set(ASM_DIALECT) diff --git a/Modules/Internal/CMakeASMLinkerInformation.cmake b/Modules/Internal/CMakeASMLinkerInformation.cmake new file mode 100644 index 0000000..5f81b1f --- /dev/null +++ b/Modules/Internal/CMakeASMLinkerInformation.cmake @@ -0,0 +1,35 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the C compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +set(_INCLUDED_FILE 0) + +# Load linker-specific information. +if(CMAKE_ASM${ASM_DIALECT}_COMPILER_LINKER_ID) + include(Linker/${CMAKE_ASM${ASM_DIALECT}_COMPILER_LINKER_ID}-ASM${ASM_DIALECT} OPTIONAL) +endif() + +# load a hardware specific file, mostly useful for embedded compilers +if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_ASM${ASM_DIALECT}_COMPILER_LINKER_ID) + include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_LINKER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + + +# load the system- and linker specific files +if(CMAKE_ASM${ASM_DIALECT}_COMPILER_LINKER_ID) + include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_LINKER_ID}-ASM${ASM_DIALECT} + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + +# We specify the platform linker information in the system file. +if (NOT _INCLUDED_FILE) + include(Platform/Linker/${CMAKE_SYSTEM_NAME}-ASM${ASM_DIALECT} OPTIONAL) +endif () + +set(CMAKE_ASM${ASM_DIALECT}_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeASM_MARMASMLinkerInformation.cmake b/Modules/Internal/CMakeASM_MARMASMLinkerInformation.cmake new file mode 100644 index 0000000..62497f2 --- /dev/null +++ b/Modules/Internal/CMakeASM_MARMASMLinkerInformation.cmake @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# support for the MS assembler, masm and masm64 + +# Load the generic ASMInformation file: +set(ASM_DIALECT "_MASM") +include(Internal/CMakeASMLinkerInformation) +set(ASM_DIALECT) diff --git a/Modules/Internal/CMakeASM_MASMLinkerInformation.cmake b/Modules/Internal/CMakeASM_MASMLinkerInformation.cmake new file mode 100644 index 0000000..62497f2 --- /dev/null +++ b/Modules/Internal/CMakeASM_MASMLinkerInformation.cmake @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# support for the MS assembler, masm and masm64 + +# Load the generic ASMInformation file: +set(ASM_DIALECT "_MASM") +include(Internal/CMakeASMLinkerInformation) +set(ASM_DIALECT) diff --git a/Modules/Internal/CMakeASM_NASMLinkerInformation.cmake b/Modules/Internal/CMakeASM_NASMLinkerInformation.cmake new file mode 100644 index 0000000..d48a018 --- /dev/null +++ b/Modules/Internal/CMakeASM_NASMLinkerInformation.cmake @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# support for the nasm assembler + +# Load the generic ASMInformation file: +set(ASM_DIALECT "_NASM") +include(Internal/CMakeASMLinkerInformation) +set(ASM_DIALECT) diff --git a/Modules/Internal/CMakeCLinkerInformation.cmake b/Modules/Internal/CMakeCLinkerInformation.cmake new file mode 100644 index 0000000..d918f84 --- /dev/null +++ b/Modules/Internal/CMakeCLinkerInformation.cmake @@ -0,0 +1,39 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the C compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +include(Internal/CMakeCommonLinkerInformation) + +set(_INCLUDED_FILE 0) + +# Load linker-specific information. +if(CMAKE_C_COMPILER_LINKER_ID) + include(Linker/${CMAKE_C_COMPILER_LINKER_ID}-C OPTIONAL) +endif() + +# load a hardware specific file, mostly useful for embedded compilers +if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_C_COMPILER_LINKER_ID) + include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_C_COMPILER_LINKER_ID}-C-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + + +# load the system- and linker specific files +if(CMAKE_C_COMPILER_LINKER_ID) + include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_C_COMPILER_LINKER_ID}-C + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + +# We specify the platform linker information in the system file. +if (NOT _INCLUDED_FILE) + include(Platform/Linker/${CMAKE_SYSTEM_NAME}-C OPTIONAL) +endif () + +_cmake_common_linker_platform_flags(C) + +set(CMAKE_C_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeCSharpLinkerInformation.cmake b/Modules/Internal/CMakeCSharpLinkerInformation.cmake new file mode 100644 index 0000000..ff73a37 --- /dev/null +++ b/Modules/Internal/CMakeCSharpLinkerInformation.cmake @@ -0,0 +1,8 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the CSharp compiler in CMake. +# For now, nothing to define + +set(CMAKE_CSharp_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeCUDALinkerInformation.cmake b/Modules/Internal/CMakeCUDALinkerInformation.cmake new file mode 100644 index 0000000..4081e50 --- /dev/null +++ b/Modules/Internal/CMakeCUDALinkerInformation.cmake @@ -0,0 +1,39 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the C compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +include(Internal/CMakeCommonLinkerInformation) + +set(_INCLUDED_FILE 0) + +# Load linker-specific information. +if(CMAKE_CUDA_COMPILER_LINKER_ID) + include(Linker/${CMAKE_CUDA_COMPILER_LINKER_ID}-CUDA OPTIONAL) +endif() + +# load a hardware specific file, mostly useful for embedded compilers +if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_CUDA_COMPILER_LINKER_ID) + include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_CUDA_COMPILER_LINKER_ID}-CUDA-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + + +# load the system- and linker specific files +if(CMAKE_CUDA_COMPILER_LINKER_ID) + include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_CUDA_COMPILER_LINKER_ID}-CUDA + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + +# We specify the platform linker information in the system file. +if (NOT _INCLUDED_FILE) + include(Platform/Linker/${CMAKE_SYSTEM_NAME}-CUDA OPTIONAL) +endif () + +_cmake_common_linker_platform_flags(CUDA) + +set(CMAKE_CUDA_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeCXXLinkerInformation.cmake b/Modules/Internal/CMakeCXXLinkerInformation.cmake new file mode 100644 index 0000000..3929bbb --- /dev/null +++ b/Modules/Internal/CMakeCXXLinkerInformation.cmake @@ -0,0 +1,39 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the C++ compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +include(Internal/CMakeCommonLinkerInformation) + +set(_INCLUDED_FILE 0) + +# Load linker-specific information. +if(CMAKE_CXX_COMPILER_LINKER_ID) + include(Linker/${CMAKE_CXX_COMPILER_LINKER_ID}-CXX OPTIONAL) +endif() + +# load a hardware specific file, mostly useful for embedded compilers +if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_CXX_COMPILER_LINKER_ID) + include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_LINKER_ID}-CXX-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + + +# load the system- and linker specific files +if(CMAKE_CXX_COMPILER_LINKER_ID) + include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_LINKER_ID}-CXX + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + +# We specify the platform linker information in the system file. +if (NOT _INCLUDED_FILE) + include(Platform/Linker/${CMAKE_SYSTEM_NAME}-CXX OPTIONAL) +endif () + +_cmake_common_linker_platform_flags(CXX) + +set(CMAKE_CXX_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeCommonLinkerInformation.cmake b/Modules/Internal/CMakeCommonLinkerInformation.cmake new file mode 100644 index 0000000..245e068 --- /dev/null +++ b/Modules/Internal/CMakeCommonLinkerInformation.cmake @@ -0,0 +1,18 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file contains common code blocks used by all the linker information +# files + +macro(_cmake_common_linker_platform_flags lang) + # Define configuration for LINK_WHAT_YOU_USE feature + if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") + if(NOT DEFINED CMAKE_${lang}_LINK_WHAT_YOU_USE_FLAG) + set(CMAKE_${lang}_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed") + endif() + if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK) + set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r) + endif() + endif() +endmacro () diff --git a/Modules/Internal/CMakeFortranLinkerInformation.cmake b/Modules/Internal/CMakeFortranLinkerInformation.cmake new file mode 100644 index 0000000..a39f3de --- /dev/null +++ b/Modules/Internal/CMakeFortranLinkerInformation.cmake @@ -0,0 +1,39 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the C compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +include(Internal/CMakeCommonLinkerInformation) + +set(_INCLUDED_FILE 0) + +# Load linker-specific information. +if(CMAKE_Fortran_COMPILER_LINKER_ID) + include(Linker/${CMAKE_Fortran_COMPILER_LINKER_ID}-Fortran OPTIONAL) +endif() + +# load a hardware specific file, mostly useful for embedded compilers +if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_Fortran_COMPILER_LINKER_ID) + include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_LINKER_ID}-Fortran-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + + +# load the system- and linker specific files +if(CMAKE_Fortran_COMPILER_LINKER_ID) + include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_LINKER_ID}-Fortran + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + +# We specify the platform linker information in the system file. +if (NOT _INCLUDED_FILE) + include(Platform/Linker/${CMAKE_SYSTEM_NAME}-Fortran OPTIONAL) +endif () + +_cmake_common_linker_platform_flags(Fortran) + +set(CMAKE_Fortran_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeHIPLinkerInformation.cmake b/Modules/Internal/CMakeHIPLinkerInformation.cmake new file mode 100644 index 0000000..d37d66d --- /dev/null +++ b/Modules/Internal/CMakeHIPLinkerInformation.cmake @@ -0,0 +1,39 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the C compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +include(Internal/CMakeCommonLinkerInformation) + +set(_INCLUDED_FILE 0) + +# Load linker-specific information. +if(CMAKE_HIP_COMPILER_LINKER_ID) + include(Linker/${CMAKE_HIP_COMPILER_LINKER_ID}-HIP OPTIONAL) +endif() + +# load a hardware specific file, mostly useful for embedded compilers +if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_HIP_COMPILER_LINKER_ID) + include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_HIP_COMPILER_LINKER_ID}-HIP-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + + +# load the system- and linker specific files +if(CMAKE_HIP_COMPILER_LINKER_ID) + include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_HIP_COMPILER_LINKER_ID}-HIP + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + +# We specify the platform linker information in the system file. +if (NOT _INCLUDED_FILE) + include(Platform/Linker/${CMAKE_SYSTEM_NAME}-HIP OPTIONAL) +endif () + +_cmake_common_linker_platform_flags(HIP) + +set(CMAKE_HIP_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeISPCLinkerInformation.cmake b/Modules/Internal/CMakeISPCLinkerInformation.cmake new file mode 100644 index 0000000..47950aa --- /dev/null +++ b/Modules/Internal/CMakeISPCLinkerInformation.cmake @@ -0,0 +1,8 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the ISPC compiler in CMake. +# For now, ISPC is not able to handle the link step + +set(CMAKE_ISPC_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeJavaLinkerInformation.cmake b/Modules/Internal/CMakeJavaLinkerInformation.cmake new file mode 100644 index 0000000..c0edadd --- /dev/null +++ b/Modules/Internal/CMakeJavaLinkerInformation.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# Java language does not have a concept of linker, so nothing to configure. diff --git a/Modules/Internal/CMakeOBJCLinkerInformation.cmake b/Modules/Internal/CMakeOBJCLinkerInformation.cmake new file mode 100644 index 0000000..ea92880 --- /dev/null +++ b/Modules/Internal/CMakeOBJCLinkerInformation.cmake @@ -0,0 +1,39 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the Objective-C compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +include(Internal/CMakeCommonLinkerInformation) + +set(_INCLUDED_FILE 0) + +# Load linker-specific information. +if(CMAKE_OBJC_COMPILER_LINKER_ID) + include(Linker/${CMAKE_OBJC_COMPILER_LINKER_ID}-OBJC OPTIONAL) +endif() + +# load a hardware specific file, mostly useful for embedded compilers +if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_OBJC_COMPILER_LINKER_ID) + include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_OBJC_COMPILER_LINKER_ID}-OBJC-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + + +# load the system- and linker specific files +if(CMAKE_OBJC_COMPILER_LINKER_ID) + include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_OBJC_COMPILER_LINKER_ID}-OBJC + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + +# We specify the platform linker information in the system file. +if (NOT _INCLUDED_FILE) + include(Platform/Linker/${CMAKE_SYSTEM_NAME}-OBJC OPTIONAL) +endif () + +_cmake_common_linker_platform_flags(OBJC) + +set(CMAKE_OBJC_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeOBJCXXLinkerInformation.cmake b/Modules/Internal/CMakeOBJCXXLinkerInformation.cmake new file mode 100644 index 0000000..3b51ba7 --- /dev/null +++ b/Modules/Internal/CMakeOBJCXXLinkerInformation.cmake @@ -0,0 +1,39 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the Objective-C++ compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +include(Internal/CMakeCommonLinkerInformation) + +set(_INCLUDED_FILE 0) + +# Load linker-specific information. +if(CMAKE_OBJCXX_COMPILER_LINKER_ID) + include(Linker/${CMAKE_OBJCXX_COMPILER_LINKER_ID}-C OPTIONAL) +endif() + +# load a hardware specific file, mostly useful for embedded compilers +if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_OBJCXX_COMPILER_LINKER_ID) + include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_OBJCXX_COMPILER_LINKER_ID}-OBJCXX-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + + +# load the system- and linker specific files +if(CMAKE_OBJCXX_COMPILER_LINKER_ID) + include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_OBJCXX_COMPILER_LINKER_ID}-C + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + +# We specify the platform linker information in the system file. +if (NOT _INCLUDED_FILE) + include(Platform/Linker/${CMAKE_SYSTEM_NAME}-OBJCXX OPTIONAL) +endif () + +_cmake_common_linker_platform_flags(OBJCXX) + +set(CMAKE_OBJCXX_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeRCLinkerInformation.cmake b/Modules/Internal/CMakeRCLinkerInformation.cmake new file mode 100644 index 0000000..1b0563e --- /dev/null +++ b/Modules/Internal/CMakeRCLinkerInformation.cmake @@ -0,0 +1,17 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the C compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +include(Internal/CMakeCommonLinkerInformation) + +set(_INCLUDED_FILE 0) + +# Foe now, no linker associated with RC language + +set(CMAKE_RC_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Internal/CMakeSwiftLinkerInformation.cmake b/Modules/Internal/CMakeSwiftLinkerInformation.cmake new file mode 100644 index 0000000..fb3e986 --- /dev/null +++ b/Modules/Internal/CMakeSwiftLinkerInformation.cmake @@ -0,0 +1,39 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This file sets the basic flags for the linker used by the Swift compiler in CMake. +# It also loads the available platform file for the system-linker +# if it exists. +# It also loads a system - linker - processor (or target hardware) +# specific file, which is mainly useful for crosscompiling and embedded systems. + +include(Internal/CMakeCommonLinkerInformation) + +set(_INCLUDED_FILE 0) + +# Load linker-specific information. +if(CMAKE_Swoft_COMPILER_LINKER_ID) + include(Linker/${CMAKE_Swift_COMPILER_LINKER_ID}-Swift OPTIONAL) +endif() + +# load a hardware specific file, mostly useful for embedded compilers +if(CMAKE_SYSTEM_PROCESSOR AND CMAKE_Swift_COMPILER_LINKER_ID) + include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_LINKER_ID}-Swift-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + + +# load the system- and linker specific files +if(CMAKE_Swift_COMPILER_LINKER_ID) + include(Platform/Linker/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_C_COMPILER_LINKER_ID}-Swift + OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) +endif() + +# We specify the platform linker information in the system file. +if (NOT _INCLUDED_FILE) + include(Platform/Linker/${CMAKE_SYSTEM_NAME}-Swift OPTIONAL) +endif () + +_cmake_common_linker_platform_flags(Swift) + +set(CMAKE_Swift_LINKER_INFORMATION_LOADED 1) diff --git a/Modules/Linker/AIX-ASM.cmake b/Modules/Linker/AIX-ASM.cmake new file mode 100644 index 0000000..0c748fc --- /dev/null +++ b/Modules/Linker/AIX-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/AIX) + +__linker_aix(ASM) diff --git a/Modules/Linker/AIX-C.cmake b/Modules/Linker/AIX-C.cmake new file mode 100644 index 0000000..c1bfd45 --- /dev/null +++ b/Modules/Linker/AIX-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/AIX) + +__linker_aix(C) diff --git a/Modules/Linker/AIX-CXX.cmake b/Modules/Linker/AIX-CXX.cmake new file mode 100644 index 0000000..34cdf20 --- /dev/null +++ b/Modules/Linker/AIX-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/AIX) + +__linker_aix(CXX) diff --git a/Modules/Linker/AIX-Fortran.cmake b/Modules/Linker/AIX-Fortran.cmake new file mode 100644 index 0000000..cf74076 --- /dev/null +++ b/Modules/Linker/AIX-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/AIX) + +__linker_aix(Fortran) diff --git a/Modules/Linker/AIX.cmake b/Modules/Linker/AIX.cmake new file mode 100644 index 0000000..6639df3 --- /dev/null +++ b/Modules/Linker/AIX.cmake @@ -0,0 +1,9 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple linkers; use include blocker. +include_guard() + +macro(__linker_aix lang) +endmacro() diff --git a/Modules/Linker/AppleClang-ASM.cmake b/Modules/Linker/AppleClang-ASM.cmake new file mode 100644 index 0000000..9f160d9 --- /dev/null +++ b/Modules/Linker/AppleClang-ASM.cmake @@ -0,0 +1,3 @@ +include(Linker/AppleClang) + +__linker_appleclang(ASM) diff --git a/Modules/Linker/AppleClang-C.cmake b/Modules/Linker/AppleClang-C.cmake new file mode 100644 index 0000000..0a98f29 --- /dev/null +++ b/Modules/Linker/AppleClang-C.cmake @@ -0,0 +1,3 @@ +include(Linker/AppleClang) + +__linker_appleclang(C) diff --git a/Modules/Linker/AppleClang-CXX.cmake b/Modules/Linker/AppleClang-CXX.cmake new file mode 100644 index 0000000..09d7ab6 --- /dev/null +++ b/Modules/Linker/AppleClang-CXX.cmake @@ -0,0 +1,3 @@ +include(Linker/AppleClang) + +__linker_appleclang(CXX) diff --git a/Modules/Linker/AppleClang-OBJC.cmake b/Modules/Linker/AppleClang-OBJC.cmake new file mode 100644 index 0000000..73cd914 --- /dev/null +++ b/Modules/Linker/AppleClang-OBJC.cmake @@ -0,0 +1,3 @@ +include(Linker/AppleClang) + +__linker_appleclang(OBJC) diff --git a/Modules/Linker/AppleClang-OBJCXX.cmake b/Modules/Linker/AppleClang-OBJCXX.cmake new file mode 100644 index 0000000..211e28a --- /dev/null +++ b/Modules/Linker/AppleClang-OBJCXX.cmake @@ -0,0 +1,3 @@ +include(Linker/AppleClang) + +__linker_appleclang(OBJCXX) diff --git a/Modules/Linker/AppleClang.cmake b/Modules/Linker/AppleClang.cmake new file mode 100644 index 0000000..4e48998 --- /dev/null +++ b/Modules/Linker/AppleClang.cmake @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple linkers; use include blocker. + +include_guard() + +macro(__linker_appleclang lang) +endmacro() diff --git a/Modules/Linker/GNU-ASM.cmake b/Modules/Linker/GNU-ASM.cmake new file mode 100644 index 0000000..d927106 --- /dev/null +++ b/Modules/Linker/GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(ASM) diff --git a/Modules/Linker/GNU-C.cmake b/Modules/Linker/GNU-C.cmake new file mode 100644 index 0000000..9a19e7d --- /dev/null +++ b/Modules/Linker/GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(C) diff --git a/Modules/Linker/GNU-CUDA.cmake b/Modules/Linker/GNU-CUDA.cmake new file mode 100644 index 0000000..82e887f --- /dev/null +++ b/Modules/Linker/GNU-CUDA.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(CUDA) diff --git a/Modules/Linker/GNU-CXX.cmake b/Modules/Linker/GNU-CXX.cmake new file mode 100644 index 0000000..6b4d719 --- /dev/null +++ b/Modules/Linker/GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(CXX) diff --git a/Modules/Linker/GNU-Fortran.cmake b/Modules/Linker/GNU-Fortran.cmake new file mode 100644 index 0000000..b4f688a --- /dev/null +++ b/Modules/Linker/GNU-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(Fortran) diff --git a/Modules/Linker/GNU-HIP.cmake b/Modules/Linker/GNU-HIP.cmake new file mode 100644 index 0000000..b2d0b2e --- /dev/null +++ b/Modules/Linker/GNU-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(HIP) diff --git a/Modules/Linker/GNU.cmake b/Modules/Linker/GNU.cmake new file mode 100644 index 0000000..1bc57e6 --- /dev/null +++ b/Modules/Linker/GNU.cmake @@ -0,0 +1,69 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple linkers; use include blocker. +include_guard() + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) +cmake_policy(SET CMP0140 NEW) + +function(__linker_gnu lang) + # define flags for linker depfile generation + set(CMAKE_${lang}_LINKER_DEPFILE_FLAGS "LINKER:--dependency-file,<DEP_FILE>") + set(CMAKE_${lang}_LINKER_DEPFILE_FORMAT gcc) + + if(NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) + ## Ensure ninja tool is recent enough... + if(CMAKE_GENERATOR MATCHES "^Ninja") + # Ninja 1.10 or upper is required + execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" --version + OUTPUT_VARIABLE _ninja_version + ERROR_VARIABLE _ninja_version) + if (_ninja_version MATCHES "[0-9]+(\\.[0-9]+)*") + set (_ninja_version "${CMAKE_MATCH_0}") + endif() + if (_ninja_version VERSION_LESS "1.10") + set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE) + endif() + endif() + + if (NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) + ## check if this feature is supported by the linker + 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() + else() + set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE) + endif() + endif() + endif() + if (CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) + set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER TRUE) + else() + set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE) + endif() + + # 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. + if (CMAKE_${lang}_COMPILER_LINKER_ID + AND 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() + + return(PROPAGATE CMAKE_${lang}_LINKER_DEPFILE_FLAGS + CMAKE_${lang}_LINKER_DEPFILE_FORMAT + CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED + CMAKE_${lang}_LINK_DEPENDS_USE_LINKER) +endfunction() + +endblock() diff --git a/Modules/Linker/GNUgold-ASM.cmake b/Modules/Linker/GNUgold-ASM.cmake new file mode 100644 index 0000000..9f920e5 --- /dev/null +++ b/Modules/Linker/GNUgold-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNUgold) + +__linker_gnugold(ASM) diff --git a/Modules/Linker/GNUgold-C.cmake b/Modules/Linker/GNUgold-C.cmake new file mode 100644 index 0000000..a510626 --- /dev/null +++ b/Modules/Linker/GNUgold-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNUgold) + +__linker_gnugold(C) diff --git a/Modules/Linker/GNUgold-CUDA.cmake b/Modules/Linker/GNUgold-CUDA.cmake new file mode 100644 index 0000000..9cd52e0 --- /dev/null +++ b/Modules/Linker/GNUgold-CUDA.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNUgold) + +__linker_gnugold(CUDA) diff --git a/Modules/Linker/GNUgold-CXX.cmake b/Modules/Linker/GNUgold-CXX.cmake new file mode 100644 index 0000000..eeb624b --- /dev/null +++ b/Modules/Linker/GNUgold-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNUgold) + +__linker_gnugold(CXX) diff --git a/Modules/Linker/GNUgold-Fortran.cmake b/Modules/Linker/GNUgold-Fortran.cmake new file mode 100644 index 0000000..97298ed --- /dev/null +++ b/Modules/Linker/GNUgold-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNUgold) + +__linker_gnugold(Fortran) diff --git a/Modules/Linker/GNUgold-HIP.cmake b/Modules/Linker/GNUgold-HIP.cmake new file mode 100644 index 0000000..900b9aa --- /dev/null +++ b/Modules/Linker/GNUgold-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNUgold) + +__linker_gnugold(HIP) diff --git a/Modules/Linker/GNUgold.cmake b/Modules/Linker/GNUgold.cmake new file mode 100644 index 0000000..4680564 --- /dev/null +++ b/Modules/Linker/GNUgold.cmake @@ -0,0 +1,18 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple linkers; use include blocker. +include_guard() + +include(Linker/GNU) + +macro(__linker_gnugold lang) + __linker_gnu(${lang}) + + # 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 because all known versions of gold linker have + # this bug. + set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE) +endmacro() diff --git a/Modules/Linker/LLD-ASM.cmake b/Modules/Linker/LLD-ASM.cmake new file mode 100644 index 0000000..255f8c5 --- /dev/null +++ b/Modules/Linker/LLD-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/LLD) + +__linker_lld(ASM) diff --git a/Modules/Linker/LLD-C.cmake b/Modules/Linker/LLD-C.cmake new file mode 100644 index 0000000..d3036b0 --- /dev/null +++ b/Modules/Linker/LLD-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/LLD) + +__linker_lld(C) diff --git a/Modules/Linker/LLD-CUDA.cmake b/Modules/Linker/LLD-CUDA.cmake new file mode 100644 index 0000000..aa72413 --- /dev/null +++ b/Modules/Linker/LLD-CUDA.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/LLD) + +__linker_lld(CUDA) diff --git a/Modules/Linker/LLD-CXX.cmake b/Modules/Linker/LLD-CXX.cmake new file mode 100644 index 0000000..0a0d2de --- /dev/null +++ b/Modules/Linker/LLD-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/LLD) + +__linker_lld(CXX) diff --git a/Modules/Linker/LLD-Fortran.cmake b/Modules/Linker/LLD-Fortran.cmake new file mode 100644 index 0000000..babcd9a --- /dev/null +++ b/Modules/Linker/LLD-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/LLD) + +__linker_lld(Fortran) diff --git a/Modules/Linker/LLD-HIP.cmake b/Modules/Linker/LLD-HIP.cmake new file mode 100644 index 0000000..8535830 --- /dev/null +++ b/Modules/Linker/LLD-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/LLD) + +__linker_lld(HIP) diff --git a/Modules/Linker/LLD-OBJC.cmake b/Modules/Linker/LLD-OBJC.cmake new file mode 100644 index 0000000..7a2af76 --- /dev/null +++ b/Modules/Linker/LLD-OBJC.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/LLD) + +__linker_lld(OBJC) diff --git a/Modules/Linker/LLD-OBJCXX.cmake b/Modules/Linker/LLD-OBJCXX.cmake new file mode 100644 index 0000000..2361e90 --- /dev/null +++ b/Modules/Linker/LLD-OBJCXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/LLD) + +__linker_lld(OBJCXX) diff --git a/Modules/Linker/LLD.cmake b/Modules/Linker/LLD.cmake new file mode 100644 index 0000000..6695f98 --- /dev/null +++ b/Modules/Linker/LLD.cmake @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include_guard() + +include(Linker/GNU) + +macro(__linker_lld lang) + __linker_gnu(${lang}) +endmacro() diff --git a/Modules/Linker/MOLD-ASM.cmake b/Modules/Linker/MOLD-ASM.cmake new file mode 100644 index 0000000..d927106 --- /dev/null +++ b/Modules/Linker/MOLD-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(ASM) diff --git a/Modules/Linker/MOLD-C.cmake b/Modules/Linker/MOLD-C.cmake new file mode 100644 index 0000000..9a19e7d --- /dev/null +++ b/Modules/Linker/MOLD-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(C) diff --git a/Modules/Linker/MOLD-CUDA.cmake b/Modules/Linker/MOLD-CUDA.cmake new file mode 100644 index 0000000..82e887f --- /dev/null +++ b/Modules/Linker/MOLD-CUDA.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(CUDA) diff --git a/Modules/Linker/MOLD-CXX.cmake b/Modules/Linker/MOLD-CXX.cmake new file mode 100644 index 0000000..6b4d719 --- /dev/null +++ b/Modules/Linker/MOLD-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(CXX) diff --git a/Modules/Linker/MOLD-Fortran.cmake b/Modules/Linker/MOLD-Fortran.cmake new file mode 100644 index 0000000..b4f688a --- /dev/null +++ b/Modules/Linker/MOLD-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(Fortran) diff --git a/Modules/Linker/MOLD-HIP.cmake b/Modules/Linker/MOLD-HIP.cmake new file mode 100644 index 0000000..b2d0b2e --- /dev/null +++ b/Modules/Linker/MOLD-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(HIP) diff --git a/Modules/Linker/MOLD-OBJC.cmake b/Modules/Linker/MOLD-OBJC.cmake new file mode 100644 index 0000000..a3c668d --- /dev/null +++ b/Modules/Linker/MOLD-OBJC.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(OBJC) diff --git a/Modules/Linker/MOLD-OBJCXX.cmake b/Modules/Linker/MOLD-OBJCXX.cmake new file mode 100644 index 0000000..0b73003 --- /dev/null +++ b/Modules/Linker/MOLD-OBJCXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/GNU) + +__linker_gnu(OBJCXX) diff --git a/Modules/Linker/Solaris-ASM.cmake b/Modules/Linker/Solaris-ASM.cmake new file mode 100644 index 0000000..2bcdd71 --- /dev/null +++ b/Modules/Linker/Solaris-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/Solaris) + +__linker_solaris(ASM) diff --git a/Modules/Linker/Solaris-C.cmake b/Modules/Linker/Solaris-C.cmake new file mode 100644 index 0000000..23458d5 --- /dev/null +++ b/Modules/Linker/Solaris-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/Solaris) + +__linker_solaris(C) diff --git a/Modules/Linker/Solaris-CXX.cmake b/Modules/Linker/Solaris-CXX.cmake new file mode 100644 index 0000000..8ddf909 --- /dev/null +++ b/Modules/Linker/Solaris-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/Solaris) + +__linker_solaris(CXX) diff --git a/Modules/Linker/Solaris-Fortran.cmake b/Modules/Linker/Solaris-Fortran.cmake new file mode 100644 index 0000000..111cf11 --- /dev/null +++ b/Modules/Linker/Solaris-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Linker/Solaris) + +__linker_solaris(Fortran) diff --git a/Modules/Linker/Solaris.cmake b/Modules/Linker/Solaris.cmake new file mode 100644 index 0000000..fbd1199 --- /dev/null +++ b/Modules/Linker/Solaris.cmake @@ -0,0 +1,9 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple linkers; use include blocker. +include_guard() + +macro(__linker_solaris lang) +endmacro() diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index 093efa1..c9f01a6 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -17,7 +17,6 @@ macro(__aix_compiler_gnu lang) set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v") set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") - set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 7 OR CMAKE_SYSTEM_VERSION VERSION_LESS 7.1) unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY) diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake index 485f31e..f7cab25 100644 --- a/Modules/Platform/AIX-XL.cmake +++ b/Modules/Platform/AIX-XL.cmake @@ -17,7 +17,6 @@ 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 DEDUPLICATION=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 bdba363..83357a7 100644 --- a/Modules/Platform/Apple-Clang.cmake +++ b/Modules/Platform/Apple-Clang.cmake @@ -15,8 +15,6 @@ macro(__apple_compiler_clang lang) set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ") endif() - set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) - set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK "-framework <LIBRARY>") set(CMAKE_${lang}_LINK_LIBRARY_USING_FRAMEWORK_SUPPORTED TRUE) set(CMAKE_${lang}_LINK_LIBRARY_FRAMEWORK_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT) diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index 01b5f91..f372955 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -16,33 +16,6 @@ set(CMAKE_GNULD_IMAGE_VERSION set(CMAKE_GENERATOR_RC windres) -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - - macro(__cygwin_compiler_gnu lang) # Binary link rules. set(CMAKE_${lang}_CREATE_SHARED_MODULE diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index b26912d..f334c5f 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -141,11 +141,6 @@ set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library,<LIBRARY>}N set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY_SUPPORTED TRUE) set(CMAKE_LINK_LIBRARY_WEAK_LIBRARY_ATTRIBUTES LIBRARY_TYPE=STATIC,SHARED DEDUPLICATION=DEFAULT OVERRIDE=DEFAULT) -# 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_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - # default to searching for frameworks first if(NOT DEFINED CMAKE_FIND_FRAMEWORK) set(CMAKE_FIND_FRAMEWORK FIRST) diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake index 891422e..c79c181 100644 --- a/Modules/Platform/FreeBSD.cmake +++ b/Modules/Platform/FreeBSD.cmake @@ -27,33 +27,6 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) endforeach() -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - - # Features for LINK_GROUP generator expression ## RESCAN: request the linker to rescan static libraries until there is ## no pending undefined symbols diff --git a/Modules/Platform/Linker/AIX-AIX-ASM.cmake b/Modules/Platform/Linker/AIX-AIX-ASM.cmake new file mode 100644 index 0000000..714e6a8 --- /dev/null +++ b/Modules/Platform/Linker/AIX-AIX-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/AIX-AIX) + +__aix_linker_aix(ASM) diff --git a/Modules/Platform/Linker/AIX-AIX-C.cmake b/Modules/Platform/Linker/AIX-AIX-C.cmake new file mode 100644 index 0000000..4cd4b9c --- /dev/null +++ b/Modules/Platform/Linker/AIX-AIX-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/AIX-AIX) + +__aix_linker_aix(C) diff --git a/Modules/Platform/Linker/AIX-AIX-CXX.cmake b/Modules/Platform/Linker/AIX-AIX-CXX.cmake new file mode 100644 index 0000000..4c6f917 --- /dev/null +++ b/Modules/Platform/Linker/AIX-AIX-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/AIX-AIX) + +__aix_linker_aix(CXX) diff --git a/Modules/Platform/Linker/AIX-AIX-Fortran.cmake b/Modules/Platform/Linker/AIX-AIX-Fortran.cmake new file mode 100644 index 0000000..c7a43c5 --- /dev/null +++ b/Modules/Platform/Linker/AIX-AIX-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/AIX-AIX) + +__aix_linker_aix(Fortran) diff --git a/Modules/Platform/Linker/AIX-AIX.cmake b/Modules/Platform/Linker/AIX-AIX.cmake new file mode 100644 index 0000000..36d7959 --- /dev/null +++ b/Modules/Platform/Linker/AIX-AIX.cmake @@ -0,0 +1,10 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +macro(__aix_linker_aix lang) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) +endmacro() diff --git a/Modules/Platform/Linker/AIX-ASM.cmake b/Modules/Platform/Linker/AIX-ASM.cmake new file mode 100644 index 0000000..6699054 --- /dev/null +++ b/Modules/Platform/Linker/AIX-ASM.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AIX is the default linker +include(Platform/Linker/AIX-AIX-ASM) diff --git a/Modules/Platform/Linker/AIX-C.cmake b/Modules/Platform/Linker/AIX-C.cmake new file mode 100644 index 0000000..5eae8d9 --- /dev/null +++ b/Modules/Platform/Linker/AIX-C.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AIX is the default linker +include(Platform/Linker/AIX-AIX-C) diff --git a/Modules/Platform/Linker/AIX-CXX.cmake b/Modules/Platform/Linker/AIX-CXX.cmake new file mode 100644 index 0000000..bd77011 --- /dev/null +++ b/Modules/Platform/Linker/AIX-CXX.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AIX is the default linker +include(Platform/Linker/AIX-AIX-CXX) diff --git a/Modules/Platform/Linker/AIX-Fortran.cmake b/Modules/Platform/Linker/AIX-Fortran.cmake new file mode 100644 index 0000000..182af9b --- /dev/null +++ b/Modules/Platform/Linker/AIX-Fortran.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AIX is the default linker +include(Platform/Linker/AIX-AIX-Fortran) diff --git a/Modules/Platform/Linker/Apple-ASM.cmake b/Modules/Platform/Linker/Apple-ASM.cmake new file mode 100644 index 0000000..8dc7684 --- /dev/null +++ b/Modules/Platform/Linker/Apple-ASM.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AppleClang is the default linker +include(Platform/Linker/Apple-AppleClang-ASM) diff --git a/Modules/Platform/Linker/Apple-AppleClang-ASM.cmake b/Modules/Platform/Linker/Apple-AppleClang-ASM.cmake new file mode 100644 index 0000000..9cf9ff2 --- /dev/null +++ b/Modules/Platform/Linker/Apple-AppleClang-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang) + +__apple_linker_appleclang(ASM) diff --git a/Modules/Platform/Linker/Apple-AppleClang-C.cmake b/Modules/Platform/Linker/Apple-AppleClang-C.cmake new file mode 100644 index 0000000..5333074 --- /dev/null +++ b/Modules/Platform/Linker/Apple-AppleClang-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang) + +__apple_linker_appleclang(C) diff --git a/Modules/Platform/Linker/Apple-AppleClang-CUDA.cmake b/Modules/Platform/Linker/Apple-AppleClang-CUDA.cmake new file mode 100644 index 0000000..87fa306 --- /dev/null +++ b/Modules/Platform/Linker/Apple-AppleClang-CUDA.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang) + +__apple_linker_appleclang(CUDA) diff --git a/Modules/Platform/Linker/Apple-AppleClang-CXX.cmake b/Modules/Platform/Linker/Apple-AppleClang-CXX.cmake new file mode 100644 index 0000000..d414824 --- /dev/null +++ b/Modules/Platform/Linker/Apple-AppleClang-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang) + +__apple_linker_appleclang(CXX) diff --git a/Modules/Platform/Linker/Apple-AppleClang-Fortran.cmake b/Modules/Platform/Linker/Apple-AppleClang-Fortran.cmake new file mode 100644 index 0000000..5637f0f --- /dev/null +++ b/Modules/Platform/Linker/Apple-AppleClang-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang) + +__apple_linker_appleclang(Fortran) diff --git a/Modules/Platform/Linker/Apple-AppleClang-OBJC.cmake b/Modules/Platform/Linker/Apple-AppleClang-OBJC.cmake new file mode 100644 index 0000000..4e39bdd --- /dev/null +++ b/Modules/Platform/Linker/Apple-AppleClang-OBJC.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang) + +__apple_linker_appleclang(OBJC) diff --git a/Modules/Platform/Linker/Apple-AppleClang-OBJCXX.cmake b/Modules/Platform/Linker/Apple-AppleClang-OBJCXX.cmake new file mode 100644 index 0000000..2779197 --- /dev/null +++ b/Modules/Platform/Linker/Apple-AppleClang-OBJCXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang) + +__apple_linker_appleclang(OBJCXX) diff --git a/Modules/Platform/Linker/Apple-AppleClang.cmake b/Modules/Platform/Linker/Apple-AppleClang.cmake new file mode 100644 index 0000000..7582ae9 --- /dev/null +++ b/Modules/Platform/Linker/Apple-AppleClang.cmake @@ -0,0 +1,16 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +macro(__apple_linker_appleclang lang) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + + # Features for LINK_LIBRARY generator expression + ## WHOLE_ARCHIVE: Force loading all members of an archive + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load,<LIB_ITEM>") + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) +endmacro() diff --git a/Modules/Platform/Linker/Apple-C.cmake b/Modules/Platform/Linker/Apple-C.cmake new file mode 100644 index 0000000..02a1da9 --- /dev/null +++ b/Modules/Platform/Linker/Apple-C.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AppleClang is the default linker +include(Platform/Linker/Apple-AppleClang-C) diff --git a/Modules/Platform/Linker/Apple-CUDA.cmake b/Modules/Platform/Linker/Apple-CUDA.cmake new file mode 100644 index 0000000..27b466d --- /dev/null +++ b/Modules/Platform/Linker/Apple-CUDA.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AppleClang is the default linker +include(Platform/Linker/Apple-AppleClang-CUDA) diff --git a/Modules/Platform/Linker/Apple-CXX.cmake b/Modules/Platform/Linker/Apple-CXX.cmake new file mode 100644 index 0000000..b2bc90b --- /dev/null +++ b/Modules/Platform/Linker/Apple-CXX.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AppleClang is the default linker +include(Platform/Linker/Apple-AppleClang-CXX) diff --git a/Modules/Platform/Linker/Apple-Fortran.cmake b/Modules/Platform/Linker/Apple-Fortran.cmake new file mode 100644 index 0000000..a39e7ae --- /dev/null +++ b/Modules/Platform/Linker/Apple-Fortran.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AppleClang is the default linker +include(Platform/Linker/Apple-AppleClang-Fortran) diff --git a/Modules/Platform/Linker/Apple-LLD-C.cmake b/Modules/Platform/Linker/Apple-LLD-C.cmake new file mode 100644 index 0000000..e38b1b7 --- /dev/null +++ b/Modules/Platform/Linker/Apple-LLD-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang-C) diff --git a/Modules/Platform/Linker/Apple-LLD-CXX.cmake b/Modules/Platform/Linker/Apple-LLD-CXX.cmake new file mode 100644 index 0000000..4e4a9ca --- /dev/null +++ b/Modules/Platform/Linker/Apple-LLD-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang-CXX) diff --git a/Modules/Platform/Linker/Apple-LLD-OBJC.cmake b/Modules/Platform/Linker/Apple-LLD-OBJC.cmake new file mode 100644 index 0000000..ff18785 --- /dev/null +++ b/Modules/Platform/Linker/Apple-LLD-OBJC.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang-OBJC) diff --git a/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake b/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake new file mode 100644 index 0000000..ba92890 --- /dev/null +++ b/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang-OBJCXX) diff --git a/Modules/Platform/Linker/Apple-MOLD-C.cmake b/Modules/Platform/Linker/Apple-MOLD-C.cmake new file mode 100644 index 0000000..e38b1b7 --- /dev/null +++ b/Modules/Platform/Linker/Apple-MOLD-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang-C) diff --git a/Modules/Platform/Linker/Apple-MOLD-CXX.cmake b/Modules/Platform/Linker/Apple-MOLD-CXX.cmake new file mode 100644 index 0000000..4e4a9ca --- /dev/null +++ b/Modules/Platform/Linker/Apple-MOLD-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang-CXX) diff --git a/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake b/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake new file mode 100644 index 0000000..ff18785 --- /dev/null +++ b/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang-OBJC) diff --git a/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake b/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake new file mode 100644 index 0000000..ba92890 --- /dev/null +++ b/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Apple-AppleClang-OBJCXX) diff --git a/Modules/Platform/Linker/Apple-OBJC.cmake b/Modules/Platform/Linker/Apple-OBJC.cmake new file mode 100644 index 0000000..316d253 --- /dev/null +++ b/Modules/Platform/Linker/Apple-OBJC.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AppleClang is the default linker +include(Platform/Linker/Apple-AppleClang-OBJC) diff --git a/Modules/Platform/Linker/Apple-OBJCXX.cmake b/Modules/Platform/Linker/Apple-OBJCXX.cmake new file mode 100644 index 0000000..23db50f --- /dev/null +++ b/Modules/Platform/Linker/Apple-OBJCXX.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# AppleClang is the default linker +include(Platform/Linker/Apple-AppleClang-OBJCXX) diff --git a/Modules/Platform/Linker/BSD-Linker-Initialize.cmake b/Modules/Platform/Linker/BSD-Linker-Initialize.cmake new file mode 100644 index 0000000..3de1dab --- /dev/null +++ b/Modules/Platform/Linker/BSD-Linker-Initialize.cmake @@ -0,0 +1,22 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(NOT _CMAKE_SYSTEM_LINKER_TYPE) + block(SCOPE_FOR VARIABLES) + execute_process(COMMAND "${CMAKE_LINKER}" --version + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output) + if(result OR NOT output MATCHES "LLD") + # assume GNU as default linker + set(_CMAKE_SYSTEM_LINKER_TYPE GNU CACHE INTERNAL "System linker type") + else() + set(_CMAKE_SYSTEM_LINKER_TYPE LLD CACHE INTERNAL "System linker type") + endif() + endblock() +endif() + +endblock() diff --git a/Modules/Platform/Linker/CYGWIN-ASM.cmake b/Modules/Platform/Linker/CYGWIN-ASM.cmake new file mode 100644 index 0000000..ab95f4c --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-ASM.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/CYGWIN-GNU-ASM) diff --git a/Modules/Platform/Linker/CYGWIN-C.cmake b/Modules/Platform/Linker/CYGWIN-C.cmake new file mode 100644 index 0000000..703624d --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-C.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/CYGWIN-GNU-C) diff --git a/Modules/Platform/Linker/CYGWIN-CXX.cmake b/Modules/Platform/Linker/CYGWIN-CXX.cmake new file mode 100644 index 0000000..7837188 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-CXX.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/CYGWIN-GNU-CXX) diff --git a/Modules/Platform/Linker/CYGWIN-Fortran.cmake b/Modules/Platform/Linker/CYGWIN-Fortran.cmake new file mode 100644 index 0000000..18ce085 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-Fortran.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/CYGWIN-GNU-Fortran) diff --git a/Modules/Platform/Linker/CYGWIN-GNU-ASM.cmake b/Modules/Platform/Linker/CYGWIN-GNU-ASM.cmake new file mode 100644 index 0000000..e65d0a0 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-GNU) + +__cygwin_linker_gnu(ASM) diff --git a/Modules/Platform/Linker/CYGWIN-GNU-C.cmake b/Modules/Platform/Linker/CYGWIN-GNU-C.cmake new file mode 100644 index 0000000..dc0a678 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-GNU) + +__cygwin_linker_gnu(C) diff --git a/Modules/Platform/Linker/CYGWIN-GNU-CXX.cmake b/Modules/Platform/Linker/CYGWIN-GNU-CXX.cmake new file mode 100644 index 0000000..a45b3cd --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-GNU) + +__cygwin_linker_gnu(CXX) diff --git a/Modules/Platform/Linker/CYGWIN-GNU-Fortran.cmake b/Modules/Platform/Linker/CYGWIN-GNU-Fortran.cmake new file mode 100644 index 0000000..7eba12a --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-GNU-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-GNU) + +__cygwin_linker_gnu(Fortran) diff --git a/Modules/Platform/Linker/CYGWIN-GNU.cmake b/Modules/Platform/Linker/CYGWIN-GNU.cmake new file mode 100644 index 0000000..8e5b970 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-GNU.cmake @@ -0,0 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +include(Platform/Linker/GNU) + +macro(__cygwin_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +endmacro() diff --git a/Modules/Platform/Linker/CYGWIN-LLD-ASM.cmake b/Modules/Platform/Linker/CYGWIN-LLD-ASM.cmake new file mode 100644 index 0000000..1c65875 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-LLD-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-LLD) + +__cygwin_linker_lld(ASM) diff --git a/Modules/Platform/Linker/CYGWIN-LLD-C.cmake b/Modules/Platform/Linker/CYGWIN-LLD-C.cmake new file mode 100644 index 0000000..a4f3063 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-LLD-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-LLD) + +__cygwin_linker_lld(C) diff --git a/Modules/Platform/Linker/CYGWIN-LLD-CXX.cmake b/Modules/Platform/Linker/CYGWIN-LLD-CXX.cmake new file mode 100644 index 0000000..5bd5063 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-LLD-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-LLD) + +__cygwin_linker_lld(CXX) diff --git a/Modules/Platform/Linker/CYGWIN-LLD-Fortran.cmake b/Modules/Platform/Linker/CYGWIN-LLD-Fortran.cmake new file mode 100644 index 0000000..3034b18 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-LLD-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-LLD) + +__cygwin_linker_lld(Fortran) diff --git a/Modules/Platform/Linker/CYGWIN-LLD.cmake b/Modules/Platform/Linker/CYGWIN-LLD.cmake new file mode 100644 index 0000000..39a3c59 --- /dev/null +++ b/Modules/Platform/Linker/CYGWIN-LLD.cmake @@ -0,0 +1,16 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + + +include(Platform/Linker/CYGWIN-GNU) + + +macro(__cygwin_linker_lld lang) + __cygwin_linker_gnu(${lang}) + + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) +endmacro() diff --git a/Modules/Platform/Linker/DragonFly-ASM.cmake b/Modules/Platform/Linker/DragonFly-ASM.cmake new file mode 100644 index 0000000..b046488 --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-ASM.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-ASM) diff --git a/Modules/Platform/Linker/DragonFly-C.cmake b/Modules/Platform/Linker/DragonFly-C.cmake new file mode 100644 index 0000000..6fedac2 --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-C) diff --git a/Modules/Platform/Linker/DragonFly-CXX.cmake b/Modules/Platform/Linker/DragonFly-CXX.cmake new file mode 100644 index 0000000..8064bf4 --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-CXX) diff --git a/Modules/Platform/Linker/DragonFly-Fortran.cmake b/Modules/Platform/Linker/DragonFly-Fortran.cmake new file mode 100644 index 0000000..64ea904 --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-Fortran.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-Fortran) diff --git a/Modules/Platform/Linker/DragonFly-GNU-ASM.cmake b/Modules/Platform/Linker/DragonFly-GNU-ASM.cmake new file mode 100644 index 0000000..e643a97 --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-GNU-ASM.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-GNU-ASM) diff --git a/Modules/Platform/Linker/DragonFly-GNU-C.cmake b/Modules/Platform/Linker/DragonFly-GNU-C.cmake new file mode 100644 index 0000000..729e68d --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-GNU-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-GNU-C) diff --git a/Modules/Platform/Linker/DragonFly-GNU-CXX.cmake b/Modules/Platform/Linker/DragonFly-GNU-CXX.cmake new file mode 100644 index 0000000..d9907ae --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-GNU-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-GNU-CXX) diff --git a/Modules/Platform/Linker/DragonFly-GNU-Fortran.cmake b/Modules/Platform/Linker/DragonFly-GNU-Fortran.cmake new file mode 100644 index 0000000..f696be9 --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-GNU-Fortran.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-GNU-Fortran) diff --git a/Modules/Platform/Linker/DragonFly-LLD-ASM.cmake b/Modules/Platform/Linker/DragonFly-LLD-ASM.cmake new file mode 100644 index 0000000..d4774cd --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-LLD-ASM.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-LLD-ASM) diff --git a/Modules/Platform/Linker/DragonFly-LLD-C.cmake b/Modules/Platform/Linker/DragonFly-LLD-C.cmake new file mode 100644 index 0000000..5ec3b76 --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-LLD-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-LLD-C) diff --git a/Modules/Platform/Linker/DragonFly-LLD-CXX.cmake b/Modules/Platform/Linker/DragonFly-LLD-CXX.cmake new file mode 100644 index 0000000..11ab59e --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-LLD-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-LLD-CXX) diff --git a/Modules/Platform/Linker/DragonFly-LLD-Fortran.cmake b/Modules/Platform/Linker/DragonFly-LLD-Fortran.cmake new file mode 100644 index 0000000..a2b5141 --- /dev/null +++ b/Modules/Platform/Linker/DragonFly-LLD-Fortran.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-LLD-Fortran) diff --git a/Modules/Platform/Linker/FreeBSD-ASM.cmake b/Modules/Platform/Linker/FreeBSD-ASM.cmake new file mode 100644 index 0000000..d8c8c86 --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-ASM.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/BSD-Linker-Initialize) + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU") + include(Platform/Linker/FreeBSD-GNU-ASM) +else() + include(Platform/Linker/FreeBSD-LLD-ASM) +endif() + +endblock() diff --git a/Modules/Platform/Linker/FreeBSD-C.cmake b/Modules/Platform/Linker/FreeBSD-C.cmake new file mode 100644 index 0000000..09975ad --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-C.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/BSD-Linker-Initialize) + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU") + include(Platform/Linker/FreeBSD-GNU-C) +else() + include(Platform/Linker/FreeBSD-LLD-C) +endif() + +endblock() diff --git a/Modules/Platform/Linker/FreeBSD-CXX.cmake b/Modules/Platform/Linker/FreeBSD-CXX.cmake new file mode 100644 index 0000000..9dcb17a --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-CXX.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/BSD-Linker-Initialize) + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU") + include(Platform/Linker/FreeBSD-GNU-CXX) +else() + include(Platform/Linker/FreeBSD-LLD-CXX) +endif() + +endblock() diff --git a/Modules/Platform/Linker/FreeBSD-Fortran.cmake b/Modules/Platform/Linker/FreeBSD-Fortran.cmake new file mode 100644 index 0000000..793e0a6 --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-Fortran.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/BSD-Linker-Initialize) + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU") + include(Platform/Linker/FreeBSD-GNU-Fortran) +else() + include(Platform/Linker/FreeBSD-LLD-Fortran) +endif() + +endblock() diff --git a/Modules/Platform/Linker/FreeBSD-GNU-ASM.cmake b/Modules/Platform/Linker/FreeBSD-GNU-ASM.cmake new file mode 100644 index 0000000..5ff8ed8 --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-GNU) + +__freebsd_linker_gnu(ASM) diff --git a/Modules/Platform/Linker/FreeBSD-GNU-C.cmake b/Modules/Platform/Linker/FreeBSD-GNU-C.cmake new file mode 100644 index 0000000..8b6f0fd --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-GNU) + +__freebsd_linker_gnu(C) diff --git a/Modules/Platform/Linker/FreeBSD-GNU-CXX.cmake b/Modules/Platform/Linker/FreeBSD-GNU-CXX.cmake new file mode 100644 index 0000000..ecc5533 --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-GNU) + +__freebsd_linker_gnu(CXX) diff --git a/Modules/Platform/Linker/FreeBSD-GNU-Fortran.cmake b/Modules/Platform/Linker/FreeBSD-GNU-Fortran.cmake new file mode 100644 index 0000000..0e20437 --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-GNU-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-GNU) + +__freebsd_linker_gnu(Fortran) diff --git a/Modules/Platform/Linker/FreeBSD-GNU.cmake b/Modules/Platform/Linker/FreeBSD-GNU.cmake new file mode 100644 index 0000000..f884857 --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-GNU.cmake @@ -0,0 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +include(Platform/Linker/GNU) + +macro(__freebsd_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +endmacro() diff --git a/Modules/Platform/Linker/FreeBSD-LLD-ASM.cmake b/Modules/Platform/Linker/FreeBSD-LLD-ASM.cmake new file mode 100644 index 0000000..0b36298 --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-LLD-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-LLD) + +__freebsd_linker_lld(ASM) diff --git a/Modules/Platform/Linker/FreeBSD-LLD-C.cmake b/Modules/Platform/Linker/FreeBSD-LLD-C.cmake new file mode 100644 index 0000000..0120dac --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-LLD-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-LLD) + +__freebsd_linker_lld(C) diff --git a/Modules/Platform/Linker/FreeBSD-LLD-CXX.cmake b/Modules/Platform/Linker/FreeBSD-LLD-CXX.cmake new file mode 100644 index 0000000..0d8aea8 --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-LLD-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-LLD) + +__freebsd_linker_lld(CXX) diff --git a/Modules/Platform/Linker/FreeBSD-LLD-Fortran.cmake b/Modules/Platform/Linker/FreeBSD-LLD-Fortran.cmake new file mode 100644 index 0000000..fa0991d --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-LLD-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/FreeBSD-LLD) + +__freebsd_linker_lld(Fortran) diff --git a/Modules/Platform/Linker/FreeBSD-LLD.cmake b/Modules/Platform/Linker/FreeBSD-LLD.cmake new file mode 100644 index 0000000..133f80c --- /dev/null +++ b/Modules/Platform/Linker/FreeBSD-LLD.cmake @@ -0,0 +1,16 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + + +include(Platform/Linker/FreeBSD-GNU) + + +macro(__freebsd_linker_lld lang) + __freebsd_linker_gnu(${lang}) + + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) +endmacro() diff --git a/Modules/Platform/Linker/GNU-ASM.cmake b/Modules/Platform/Linker/GNU-ASM.cmake new file mode 100644 index 0000000..e78201c --- /dev/null +++ b/Modules/Platform/Linker/GNU-ASM.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/GNU-GNU-ASM) diff --git a/Modules/Platform/Linker/GNU-C.cmake b/Modules/Platform/Linker/GNU-C.cmake new file mode 100644 index 0000000..7667940 --- /dev/null +++ b/Modules/Platform/Linker/GNU-C.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/GNU-GNU-C) diff --git a/Modules/Platform/Linker/GNU-CXX.cmake b/Modules/Platform/Linker/GNU-CXX.cmake new file mode 100644 index 0000000..d653f34 --- /dev/null +++ b/Modules/Platform/Linker/GNU-CXX.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/GNU-GNU-CXX) diff --git a/Modules/Platform/Linker/GNU-Fortran.cmake b/Modules/Platform/Linker/GNU-Fortran.cmake new file mode 100644 index 0000000..99bcb76 --- /dev/null +++ b/Modules/Platform/Linker/GNU-Fortran.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/GNU-GNU-Fortran) diff --git a/Modules/Platform/Linker/GNU-GNU-ASM.cmake b/Modules/Platform/Linker/GNU-GNU-ASM.cmake new file mode 100644 index 0000000..39316b9 --- /dev/null +++ b/Modules/Platform/Linker/GNU-GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/GNU-GNU) + +__gnu_linker_gnu(ASM) diff --git a/Modules/Platform/Linker/GNU-GNU-C.cmake b/Modules/Platform/Linker/GNU-GNU-C.cmake new file mode 100644 index 0000000..12a9883 --- /dev/null +++ b/Modules/Platform/Linker/GNU-GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/GNU-GNU) + +__gnu_linker_gnu(C) diff --git a/Modules/Platform/Linker/GNU-GNU-CXX.cmake b/Modules/Platform/Linker/GNU-GNU-CXX.cmake new file mode 100644 index 0000000..776f604 --- /dev/null +++ b/Modules/Platform/Linker/GNU-GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/GNU-GNU) + +__gnu_linker_gnu(CXX) diff --git a/Modules/Platform/Linker/GNU-GNU-Fortran.cmake b/Modules/Platform/Linker/GNU-GNU-Fortran.cmake new file mode 100644 index 0000000..87b5c9b --- /dev/null +++ b/Modules/Platform/Linker/GNU-GNU-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/GNU-GNU) + +__gnu_linker_gnu(Fortran) diff --git a/Modules/Platform/Linker/GNU-GNU.cmake b/Modules/Platform/Linker/GNU-GNU.cmake new file mode 100644 index 0000000..a1adf14 --- /dev/null +++ b/Modules/Platform/Linker/GNU-GNU.cmake @@ -0,0 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +include(Platform/Linker/GNU) + +macro(__gnu_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +endmacro() diff --git a/Modules/Platform/Linker/GNU.cmake b/Modules/Platform/Linker/GNU.cmake new file mode 100644 index 0000000..5f11674 --- /dev/null +++ b/Modules/Platform/Linker/GNU.cmake @@ -0,0 +1,51 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +# WHOLE_ARCHIVE Feature for LINK_LIBRARY generator expression +## check linker capabilities +function(__cmake_set_whole_archive_feature __linker) + unset(__lang) + if(ARGC EQUAL "2") + set(__lang "${ARGV1}_") + endif() + + if(NOT __linker) + set(_CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") + endif() + + if(NOT DEFINED _CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED) + execute_process(COMMAND "${__linker}" --help + OUTPUT_VARIABLE __linker_help + ERROR_VARIABLE __linker_help) + if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") + set(_CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") + else() + set(_CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") + endif() + endif() + ## WHOLE_ARCHIVE: Force loading all members of an archive + if(_CMAKE_${__lang}LINKER_PUSHPOP_STATE_SUPPORTED) + set(CMAKE_${__lang}LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" + "<LINK_ITEM>" + "LINKER:--pop-state" PARENT_SCOPE) + else() + set(CMAKE_${__lang}LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" + "<LINK_ITEM>" + "LINKER:--no-whole-archive" PARENT_SCOPE) + endif() + set(CMAKE_${__lang}LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE PARENT_SCOPE) + set(CMAKE_${__lang}LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT PARENT_SCOPE) +endfunction() + + +## Configure system linker +__cmake_set_whole_archive_feature("${CMAKE_LINKER}") + +endblock() diff --git a/Modules/Platform/Linker/Linux-ASM.cmake b/Modules/Platform/Linker/Linux-ASM.cmake new file mode 100644 index 0000000..67e8e79 --- /dev/null +++ b/Modules/Platform/Linker/Linux-ASM.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/Linux-GNU-ASM) diff --git a/Modules/Platform/Linker/Linux-C.cmake b/Modules/Platform/Linker/Linux-C.cmake new file mode 100644 index 0000000..f40c631 --- /dev/null +++ b/Modules/Platform/Linker/Linux-C.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/Linux-GNU-C) diff --git a/Modules/Platform/Linker/Linux-CUDA.cmake b/Modules/Platform/Linker/Linux-CUDA.cmake new file mode 100644 index 0000000..191c347 --- /dev/null +++ b/Modules/Platform/Linker/Linux-CUDA.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/Linux-GNU-CUDA) diff --git a/Modules/Platform/Linker/Linux-CXX.cmake b/Modules/Platform/Linker/Linux-CXX.cmake new file mode 100644 index 0000000..638f3c7 --- /dev/null +++ b/Modules/Platform/Linker/Linux-CXX.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/Linux-GNU-CXX) diff --git a/Modules/Platform/Linker/Linux-Fortran.cmake b/Modules/Platform/Linker/Linux-Fortran.cmake new file mode 100644 index 0000000..6bfcc69 --- /dev/null +++ b/Modules/Platform/Linker/Linux-Fortran.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/Linux-GNU-Fortran) diff --git a/Modules/Platform/Linker/Linux-GNU-ASM.cmake b/Modules/Platform/Linker/Linux-GNU-ASM.cmake new file mode 100644 index 0000000..5812c08 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU) + +__linux_linker_gnu(ASM) diff --git a/Modules/Platform/Linker/Linux-GNU-C.cmake b/Modules/Platform/Linker/Linux-GNU-C.cmake new file mode 100644 index 0000000..5bb3224 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU) + +__linux_linker_gnu(C) diff --git a/Modules/Platform/Linker/Linux-GNU-CUDA.cmake b/Modules/Platform/Linker/Linux-GNU-CUDA.cmake new file mode 100644 index 0000000..5a3faa4 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNU-CUDA.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU) + +__linux_linker_gnu(CUDA) diff --git a/Modules/Platform/Linker/Linux-GNU-CXX.cmake b/Modules/Platform/Linker/Linux-GNU-CXX.cmake new file mode 100644 index 0000000..8b0afa7 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU) + +__linux_linker_gnu(CXX) diff --git a/Modules/Platform/Linker/Linux-GNU-Fortran.cmake b/Modules/Platform/Linker/Linux-GNU-Fortran.cmake new file mode 100644 index 0000000..b7f8a16 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNU-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU) + +__linux_linker_gnu(Fortran) diff --git a/Modules/Platform/Linker/Linux-GNU-HIP.cmake b/Modules/Platform/Linker/Linux-GNU-HIP.cmake new file mode 100644 index 0000000..6fb9a06 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNU-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU) + +__linux_linker_gnu(HIP) diff --git a/Modules/Platform/Linker/Linux-GNU.cmake b/Modules/Platform/Linker/Linux-GNU.cmake new file mode 100644 index 0000000..6668141 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNU.cmake @@ -0,0 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +include(Platform/Linker/GNU) + +macro(__linux_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +endmacro() diff --git a/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake b/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake new file mode 100644 index 0000000..bfef8b9 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU-ASM) diff --git a/Modules/Platform/Linker/Linux-GNUgold-C.cmake b/Modules/Platform/Linker/Linux-GNUgold-C.cmake new file mode 100644 index 0000000..2d0efda --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNUgold-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU-C) diff --git a/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake b/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake new file mode 100644 index 0000000..d67dc94 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU-CUDA) diff --git a/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake b/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake new file mode 100644 index 0000000..33c46d5 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU-CXX) diff --git a/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake b/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake new file mode 100644 index 0000000..a01acda --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU-Fortran) diff --git a/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake b/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake new file mode 100644 index 0000000..6d1e492 --- /dev/null +++ b/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-GNU-HIP) diff --git a/Modules/Platform/Linker/Linux-HIP.cmake b/Modules/Platform/Linker/Linux-HIP.cmake new file mode 100644 index 0000000..4c94abc --- /dev/null +++ b/Modules/Platform/Linker/Linux-HIP.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/Linux-GNU-HIP) diff --git a/Modules/Platform/Linker/Linux-LLD-ASM.cmake b/Modules/Platform/Linker/Linux-LLD-ASM.cmake new file mode 100644 index 0000000..7196133 --- /dev/null +++ b/Modules/Platform/Linker/Linux-LLD-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-LLD) + +__linux_linker_lld(ASM) diff --git a/Modules/Platform/Linker/Linux-LLD-C.cmake b/Modules/Platform/Linker/Linux-LLD-C.cmake new file mode 100644 index 0000000..f8a409e --- /dev/null +++ b/Modules/Platform/Linker/Linux-LLD-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-LLD) + +__linux_linker_lld(C) diff --git a/Modules/Platform/Linker/Linux-LLD-CUDA.cmake b/Modules/Platform/Linker/Linux-LLD-CUDA.cmake new file mode 100644 index 0000000..161c7bf --- /dev/null +++ b/Modules/Platform/Linker/Linux-LLD-CUDA.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-LLD) + +__linux_linker_lld(CUDA) diff --git a/Modules/Platform/Linker/Linux-LLD-CXX.cmake b/Modules/Platform/Linker/Linux-LLD-CXX.cmake new file mode 100644 index 0000000..8530a38 --- /dev/null +++ b/Modules/Platform/Linker/Linux-LLD-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-LLD) + +__linux_linker_lld(CXX) diff --git a/Modules/Platform/Linker/Linux-LLD-Fortran.cmake b/Modules/Platform/Linker/Linux-LLD-Fortran.cmake new file mode 100644 index 0000000..70cd3b4 --- /dev/null +++ b/Modules/Platform/Linker/Linux-LLD-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-LLD) + +__linux_linker_lld(Fortran) diff --git a/Modules/Platform/Linker/Linux-LLD-HIP.cmake b/Modules/Platform/Linker/Linux-LLD-HIP.cmake new file mode 100644 index 0000000..ee08495 --- /dev/null +++ b/Modules/Platform/Linker/Linux-LLD-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-LLD) + +__linux_linker_lld(HIP) diff --git a/Modules/Platform/Linker/Linux-LLD.cmake b/Modules/Platform/Linker/Linux-LLD.cmake new file mode 100644 index 0000000..afe5d1c --- /dev/null +++ b/Modules/Platform/Linker/Linux-LLD.cmake @@ -0,0 +1,16 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + + +include(Platform/Linker/Linux-GNU) + + +macro(__linux_linker_lld lang) + __linux_linker_gnu(${lang}) + + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) +endmacro() diff --git a/Modules/Platform/Linker/Linux-MOLD-ASM.cmake b/Modules/Platform/Linker/Linux-MOLD-ASM.cmake new file mode 100644 index 0000000..5cc7a71 --- /dev/null +++ b/Modules/Platform/Linker/Linux-MOLD-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-MOLD) + +__linux_linker_mold(ASM) diff --git a/Modules/Platform/Linker/Linux-MOLD-C.cmake b/Modules/Platform/Linker/Linux-MOLD-C.cmake new file mode 100644 index 0000000..a62c2c9 --- /dev/null +++ b/Modules/Platform/Linker/Linux-MOLD-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-MOLD) + +__linux_linker_mold(C) diff --git a/Modules/Platform/Linker/Linux-MOLD-CUDA.cmake b/Modules/Platform/Linker/Linux-MOLD-CUDA.cmake new file mode 100644 index 0000000..5248036 --- /dev/null +++ b/Modules/Platform/Linker/Linux-MOLD-CUDA.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-MOLD) + +__linux_linker_mold(CUDA) diff --git a/Modules/Platform/Linker/Linux-MOLD-CXX.cmake b/Modules/Platform/Linker/Linux-MOLD-CXX.cmake new file mode 100644 index 0000000..4c43624 --- /dev/null +++ b/Modules/Platform/Linker/Linux-MOLD-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-MOLD) + +__linux_linker_mold(CXX) diff --git a/Modules/Platform/Linker/Linux-MOLD-Fortran.cmake b/Modules/Platform/Linker/Linux-MOLD-Fortran.cmake new file mode 100644 index 0000000..e26bd5d --- /dev/null +++ b/Modules/Platform/Linker/Linux-MOLD-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-MOLD) + +__linux_linker_mold(Fortran) diff --git a/Modules/Platform/Linker/Linux-MOLD-HIP.cmake b/Modules/Platform/Linker/Linux-MOLD-HIP.cmake new file mode 100644 index 0000000..5dd6c16 --- /dev/null +++ b/Modules/Platform/Linker/Linux-MOLD-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Linux-MOLD) + +__linux_linker_mold(HIP) diff --git a/Modules/Platform/Linker/Linux-MOLD.cmake b/Modules/Platform/Linker/Linux-MOLD.cmake new file mode 100644 index 0000000..672e699 --- /dev/null +++ b/Modules/Platform/Linker/Linux-MOLD.cmake @@ -0,0 +1,16 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + + +include(Platform/Linker/Linux-GNU) + + +macro(__linux_linker_mold lang) + __linux_linker_gnu(${lang}) + + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) +endmacro() diff --git a/Modules/Platform/Linker/MSYS-ASM.cmake b/Modules/Platform/Linker/MSYS-ASM.cmake new file mode 100644 index 0000000..9f72f5f --- /dev/null +++ b/Modules/Platform/Linker/MSYS-ASM.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-ASM) diff --git a/Modules/Platform/Linker/MSYS-C.cmake b/Modules/Platform/Linker/MSYS-C.cmake new file mode 100644 index 0000000..5ea9f31 --- /dev/null +++ b/Modules/Platform/Linker/MSYS-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-C) diff --git a/Modules/Platform/Linker/MSYS-CXX.cmake b/Modules/Platform/Linker/MSYS-CXX.cmake new file mode 100644 index 0000000..a64b538 --- /dev/null +++ b/Modules/Platform/Linker/MSYS-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-CXX) diff --git a/Modules/Platform/Linker/MSYS-Fortran.cmake b/Modules/Platform/Linker/MSYS-Fortran.cmake new file mode 100644 index 0000000..390063d --- /dev/null +++ b/Modules/Platform/Linker/MSYS-Fortran.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-Fortran) diff --git a/Modules/Platform/Linker/MSYS-GNU-ASM.cmake b/Modules/Platform/Linker/MSYS-GNU-ASM.cmake new file mode 100644 index 0000000..f85298e --- /dev/null +++ b/Modules/Platform/Linker/MSYS-GNU-ASM.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-GNU-ASM) diff --git a/Modules/Platform/Linker/MSYS-GNU-C.cmake b/Modules/Platform/Linker/MSYS-GNU-C.cmake new file mode 100644 index 0000000..4e6415f --- /dev/null +++ b/Modules/Platform/Linker/MSYS-GNU-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-GNU-C) diff --git a/Modules/Platform/Linker/MSYS-GNU-CXX.cmake b/Modules/Platform/Linker/MSYS-GNU-CXX.cmake new file mode 100644 index 0000000..2a48ddc --- /dev/null +++ b/Modules/Platform/Linker/MSYS-GNU-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-GNU-CXX) diff --git a/Modules/Platform/Linker/MSYS-GNU-Fortran.cmake b/Modules/Platform/Linker/MSYS-GNU-Fortran.cmake new file mode 100644 index 0000000..5055d22 --- /dev/null +++ b/Modules/Platform/Linker/MSYS-GNU-Fortran.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-GNU-Fortran) diff --git a/Modules/Platform/Linker/MSYS-LLD-ASM.cmake b/Modules/Platform/Linker/MSYS-LLD-ASM.cmake new file mode 100644 index 0000000..907d084 --- /dev/null +++ b/Modules/Platform/Linker/MSYS-LLD-ASM.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-LLD-ASM) diff --git a/Modules/Platform/Linker/MSYS-LLD-C.cmake b/Modules/Platform/Linker/MSYS-LLD-C.cmake new file mode 100644 index 0000000..bef158d --- /dev/null +++ b/Modules/Platform/Linker/MSYS-LLD-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-LLD-C) diff --git a/Modules/Platform/Linker/MSYS-LLD-CXX.cmake b/Modules/Platform/Linker/MSYS-LLD-CXX.cmake new file mode 100644 index 0000000..59d9abc --- /dev/null +++ b/Modules/Platform/Linker/MSYS-LLD-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-LLD-CXX) diff --git a/Modules/Platform/Linker/MSYS-LLD-Fortran.cmake b/Modules/Platform/Linker/MSYS-LLD-Fortran.cmake new file mode 100644 index 0000000..f705b91 --- /dev/null +++ b/Modules/Platform/Linker/MSYS-LLD-Fortran.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/CYGWIN-LLD-Fortran) diff --git a/Modules/Platform/Linker/MirBSD-ASM.cmake b/Modules/Platform/Linker/MirBSD-ASM.cmake new file mode 100644 index 0000000..d2c419e --- /dev/null +++ b/Modules/Platform/Linker/MirBSD-ASM.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-ASM) diff --git a/Modules/Platform/Linker/MirBSD-C.cmake b/Modules/Platform/Linker/MirBSD-C.cmake new file mode 100644 index 0000000..c59f251 --- /dev/null +++ b/Modules/Platform/Linker/MirBSD-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-C) diff --git a/Modules/Platform/Linker/MirBSD-CXX.cmake b/Modules/Platform/Linker/MirBSD-CXX.cmake new file mode 100644 index 0000000..9a76d37 --- /dev/null +++ b/Modules/Platform/Linker/MirBSD-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-CXX) diff --git a/Modules/Platform/Linker/MirBSD-Fortran.cmake b/Modules/Platform/Linker/MirBSD-Fortran.cmake new file mode 100644 index 0000000..9ab9886 --- /dev/null +++ b/Modules/Platform/Linker/MirBSD-Fortran.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-Fortran) diff --git a/Modules/Platform/Linker/MirBSD-GNU-ASM.cmake b/Modules/Platform/Linker/MirBSD-GNU-ASM.cmake new file mode 100644 index 0000000..f552a94 --- /dev/null +++ b/Modules/Platform/Linker/MirBSD-GNU-ASM.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-GNU-ASM) diff --git a/Modules/Platform/Linker/MirBSD-GNU-C.cmake b/Modules/Platform/Linker/MirBSD-GNU-C.cmake new file mode 100644 index 0000000..ad337d0 --- /dev/null +++ b/Modules/Platform/Linker/MirBSD-GNU-C.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-GNU-C) diff --git a/Modules/Platform/Linker/MirBSD-GNU-CXX.cmake b/Modules/Platform/Linker/MirBSD-GNU-CXX.cmake new file mode 100644 index 0000000..1edb8e8 --- /dev/null +++ b/Modules/Platform/Linker/MirBSD-GNU-CXX.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-GNU-CXX) diff --git a/Modules/Platform/Linker/MirBSD-GNU-Fortran.cmake b/Modules/Platform/Linker/MirBSD-GNU-Fortran.cmake new file mode 100644 index 0000000..70890a7 --- /dev/null +++ b/Modules/Platform/Linker/MirBSD-GNU-Fortran.cmake @@ -0,0 +1,4 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-GNU-Fortran) diff --git a/Modules/Platform/Linker/NetBSD-ASM.cmake b/Modules/Platform/Linker/NetBSD-ASM.cmake new file mode 100644 index 0000000..72a9119 --- /dev/null +++ b/Modules/Platform/Linker/NetBSD-ASM.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/NetBSD-GNU-ASM) diff --git a/Modules/Platform/Linker/NetBSD-C.cmake b/Modules/Platform/Linker/NetBSD-C.cmake new file mode 100644 index 0000000..6e08344 --- /dev/null +++ b/Modules/Platform/Linker/NetBSD-C.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/NetBSD-GNU-C) diff --git a/Modules/Platform/Linker/NetBSD-CXX.cmake b/Modules/Platform/Linker/NetBSD-CXX.cmake new file mode 100644 index 0000000..23d6cac --- /dev/null +++ b/Modules/Platform/Linker/NetBSD-CXX.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/NetBSD-GNU-CXX) diff --git a/Modules/Platform/Linker/NetBSD-Fortran.cmake b/Modules/Platform/Linker/NetBSD-Fortran.cmake new file mode 100644 index 0000000..6684127 --- /dev/null +++ b/Modules/Platform/Linker/NetBSD-Fortran.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/NetBSD-GNU-Fortran) diff --git a/Modules/Platform/Linker/NetBSD-GNU-ASM.cmake b/Modules/Platform/Linker/NetBSD-GNU-ASM.cmake new file mode 100644 index 0000000..533589e --- /dev/null +++ b/Modules/Platform/Linker/NetBSD-GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/NetBSD-GNU) + +__netbsd_linker_gnu(ASM) diff --git a/Modules/Platform/Linker/NetBSD-GNU-C.cmake b/Modules/Platform/Linker/NetBSD-GNU-C.cmake new file mode 100644 index 0000000..2f00856 --- /dev/null +++ b/Modules/Platform/Linker/NetBSD-GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/NetBSD-GNU) + +__netbsd_linker_gnu(C) diff --git a/Modules/Platform/Linker/NetBSD-GNU-CXX.cmake b/Modules/Platform/Linker/NetBSD-GNU-CXX.cmake new file mode 100644 index 0000000..6e5da90 --- /dev/null +++ b/Modules/Platform/Linker/NetBSD-GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/NetBSD-GNU) + +__netbsd_linker_gnu(CXX) diff --git a/Modules/Platform/Linker/NetBSD-GNU-Fortran.cmake b/Modules/Platform/Linker/NetBSD-GNU-Fortran.cmake new file mode 100644 index 0000000..83d7784 --- /dev/null +++ b/Modules/Platform/Linker/NetBSD-GNU-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/NetBSD-GNU) + +__netbsd_linker_gnu(Fortran) diff --git a/Modules/Platform/Linker/NetBSD-GNU.cmake b/Modules/Platform/Linker/NetBSD-GNU.cmake new file mode 100644 index 0000000..f06e491 --- /dev/null +++ b/Modules/Platform/Linker/NetBSD-GNU.cmake @@ -0,0 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +include(Platform/Linker/GNU) + +macro(__netbsd_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +endmacro() diff --git a/Modules/Platform/Linker/OpenBSD-ASM.cmake b/Modules/Platform/Linker/OpenBSD-ASM.cmake new file mode 100644 index 0000000..cd0b25e --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-ASM.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/BSD-Linker-Initialize) + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU") + include(Platform/Linker/OpenBSD-GNU-ASM) +else() + include(Platform/Linker/OpenBSD-LLD-ASM) +endif() + +endblock() diff --git a/Modules/Platform/Linker/OpenBSD-C.cmake b/Modules/Platform/Linker/OpenBSD-C.cmake new file mode 100644 index 0000000..6685807 --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-C.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/BSD-Linker-Initialize) + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU") + include(Platform/Linker/OpenBSD-GNU-C) +else() + include(Platform/Linker/OpenBSD-LLD-C) +endif() + +endblock() diff --git a/Modules/Platform/Linker/OpenBSD-CXX.cmake b/Modules/Platform/Linker/OpenBSD-CXX.cmake new file mode 100644 index 0000000..4a3d6f8 --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-CXX.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/BSD-Linker-Initialize) + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU") + include(Platform/Linker/OpenBSD-GNU-CXX) +else() + include(Platform/Linker/OpenBSD-LLD-CXX) +endif() + +endblock() diff --git a/Modules/Platform/Linker/OpenBSD-Fortran.cmake b/Modules/Platform/Linker/OpenBSD-Fortran.cmake new file mode 100644 index 0000000..4ec2fe5 --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-Fortran.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/BSD-Linker-Initialize) + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(_CMAKE_SYSTEM_LINKER_TYPE STREQUAL "GNU") + include(Platform/Linker/OpenBSD-GNU-Fortran) +else() + include(Platform/Linker/OpenBSD-LLD-Fortran) +endif() + +endblock() diff --git a/Modules/Platform/Linker/OpenBSD-GNU-ASM.cmake b/Modules/Platform/Linker/OpenBSD-GNU-ASM.cmake new file mode 100644 index 0000000..6ad992d --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-GNU) + +__openbsd_linker_gnu(ASM) diff --git a/Modules/Platform/Linker/OpenBSD-GNU-C.cmake b/Modules/Platform/Linker/OpenBSD-GNU-C.cmake new file mode 100644 index 0000000..64c8adf --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-GNU) + +__openbsd_linker_gnu(C) diff --git a/Modules/Platform/Linker/OpenBSD-GNU-CXX.cmake b/Modules/Platform/Linker/OpenBSD-GNU-CXX.cmake new file mode 100644 index 0000000..98668e56 --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-GNU) + +__openbsd_linker_gnu(CXX) diff --git a/Modules/Platform/Linker/OpenBSD-GNU-Fortran.cmake b/Modules/Platform/Linker/OpenBSD-GNU-Fortran.cmake new file mode 100644 index 0000000..0f2b11f --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-GNU-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-GNU) + +__openbsd_linker_gnu(Fortran) diff --git a/Modules/Platform/Linker/OpenBSD-GNU.cmake b/Modules/Platform/Linker/OpenBSD-GNU.cmake new file mode 100644 index 0000000..b30e467 --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-GNU.cmake @@ -0,0 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +include(Platform/Linker/GNU) + +macro(__openbsd_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +endmacro() diff --git a/Modules/Platform/Linker/OpenBSD-LLD-ASM.cmake b/Modules/Platform/Linker/OpenBSD-LLD-ASM.cmake new file mode 100644 index 0000000..008e79a --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-LLD-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-LLD) + +__openbsd_linker_lld(ASM) diff --git a/Modules/Platform/Linker/OpenBSD-LLD-C.cmake b/Modules/Platform/Linker/OpenBSD-LLD-C.cmake new file mode 100644 index 0000000..20f8d12 --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-LLD-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-LLD) + +__openbsd_linker_lld(C) diff --git a/Modules/Platform/Linker/OpenBSD-LLD-CXX.cmake b/Modules/Platform/Linker/OpenBSD-LLD-CXX.cmake new file mode 100644 index 0000000..d0fd59f --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-LLD-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-LLD) + +__openbsd_linker_lld(CXX) diff --git a/Modules/Platform/Linker/OpenBSD-LLD-Fortran.cmake b/Modules/Platform/Linker/OpenBSD-LLD-Fortran.cmake new file mode 100644 index 0000000..55efce3 --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-LLD-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/OpenBSD-LLD) + +__openbsd_linker_lld(Fortran) diff --git a/Modules/Platform/Linker/OpenBSD-LLD.cmake b/Modules/Platform/Linker/OpenBSD-LLD.cmake new file mode 100644 index 0000000..522a232 --- /dev/null +++ b/Modules/Platform/Linker/OpenBSD-LLD.cmake @@ -0,0 +1,16 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + + +include(Platform/Linker/OpenBSD-GNU) + + +macro(__openbsd_linker_lld lang) + __openbsd_linker_gnu(${lang}) + + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) +endmacro() diff --git a/Modules/Platform/Linker/SerenityOS-ASM.cmake b/Modules/Platform/Linker/SerenityOS-ASM.cmake new file mode 100644 index 0000000..98fe46f --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-ASM.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/SerenityOS-GNU-ASM) diff --git a/Modules/Platform/Linker/SerenityOS-C.cmake b/Modules/Platform/Linker/SerenityOS-C.cmake new file mode 100644 index 0000000..d4aa953 --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-C.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/SerenityOS-GNU-C) diff --git a/Modules/Platform/Linker/SerenityOS-CXX.cmake b/Modules/Platform/Linker/SerenityOS-CXX.cmake new file mode 100644 index 0000000..34e9311 --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-CXX.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# GNU is the default linker +include(Platform/Linker/SerenityOS-GNU-CXX) diff --git a/Modules/Platform/Linker/SerenityOS-GNU-ASM.cmake b/Modules/Platform/Linker/SerenityOS-GNU-ASM.cmake new file mode 100644 index 0000000..3ea7242 --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SerenityOS-GNU) + +__serenityos_linker_gnu(ASM) diff --git a/Modules/Platform/Linker/SerenityOS-GNU-C.cmake b/Modules/Platform/Linker/SerenityOS-GNU-C.cmake new file mode 100644 index 0000000..c66d797 --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SerenityOS-GNU) + +__serenityos_linker_gnu(C) diff --git a/Modules/Platform/Linker/SerenityOS-GNU-CXX.cmake b/Modules/Platform/Linker/SerenityOS-GNU-CXX.cmake new file mode 100644 index 0000000..ff1f677 --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SerenityOS-GNU) + +__serenityos_linker_gnu(CXX) diff --git a/Modules/Platform/Linker/SerenityOS-GNU.cmake b/Modules/Platform/Linker/SerenityOS-GNU.cmake new file mode 100644 index 0000000..9b06bfb --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-GNU.cmake @@ -0,0 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +include(Platform/Linker/GNU) + +macro(__serenityos_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +endmacro() diff --git a/Modules/Platform/Linker/SerenityOS-LLD-ASM.cmake b/Modules/Platform/Linker/SerenityOS-LLD-ASM.cmake new file mode 100644 index 0000000..23be6bd --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-LLD-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SerenityOS-LLD) + +__serenityos_linker_lld(ASM) diff --git a/Modules/Platform/Linker/SerenityOS-LLD-C.cmake b/Modules/Platform/Linker/SerenityOS-LLD-C.cmake new file mode 100644 index 0000000..43b077c --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-LLD-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SerenityOS-LLD) + +__serenityos_linker_lld(C) diff --git a/Modules/Platform/Linker/SerenityOS-LLD-CXX.cmake b/Modules/Platform/Linker/SerenityOS-LLD-CXX.cmake new file mode 100644 index 0000000..95851ca --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-LLD-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SerenityOS-LLD) + +__serenityos_linker_lld(CXX) diff --git a/Modules/Platform/Linker/SerenityOS-LLD.cmake b/Modules/Platform/Linker/SerenityOS-LLD.cmake new file mode 100644 index 0000000..9f34e79 --- /dev/null +++ b/Modules/Platform/Linker/SerenityOS-LLD.cmake @@ -0,0 +1,16 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + + +include(Platform/Linker/SerenityOS-GNU) + + +macro(__serenityos_linker_lld lang) + __serenityos_linker_gnu(${lang}) + + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) +endmacro() diff --git a/Modules/Platform/Linker/SunOS-ASM.cmake b/Modules/Platform/Linker/SunOS-ASM.cmake new file mode 100644 index 0000000..0013e0b --- /dev/null +++ b/Modules/Platform/Linker/SunOS-ASM.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Solaris is the default linker +include(Platform/Linker/SunOS-Solaris-ASM) diff --git a/Modules/Platform/Linker/SunOS-C.cmake b/Modules/Platform/Linker/SunOS-C.cmake new file mode 100644 index 0000000..fe90f6a --- /dev/null +++ b/Modules/Platform/Linker/SunOS-C.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Solaris is the default linker +include(Platform/Linker/SunOS-Solaris-C) diff --git a/Modules/Platform/Linker/SunOS-CXX.cmake b/Modules/Platform/Linker/SunOS-CXX.cmake new file mode 100644 index 0000000..0111500 --- /dev/null +++ b/Modules/Platform/Linker/SunOS-CXX.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Solaris is the default linker +include(Platform/Linker/SunOS-Solaris-CXX) diff --git a/Modules/Platform/Linker/SunOS-Fortran.cmake b/Modules/Platform/Linker/SunOS-Fortran.cmake new file mode 100644 index 0000000..6252846 --- /dev/null +++ b/Modules/Platform/Linker/SunOS-Fortran.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Solaris is the default linker +include(Platform/Linker/SunOS-Solaris-Fortran) diff --git a/Modules/Platform/Linker/SunOS-GNU-ASM.cmake b/Modules/Platform/Linker/SunOS-GNU-ASM.cmake new file mode 100644 index 0000000..d69b617 --- /dev/null +++ b/Modules/Platform/Linker/SunOS-GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SunOS-GNU) + +__sunos_linker_gnu(ASM) diff --git a/Modules/Platform/Linker/SunOS-GNU-C.cmake b/Modules/Platform/Linker/SunOS-GNU-C.cmake new file mode 100644 index 0000000..76554ce --- /dev/null +++ b/Modules/Platform/Linker/SunOS-GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SunOS-GNU) + +__sunos_linker_gnu(C) diff --git a/Modules/Platform/Linker/SunOS-GNU-CXX.cmake b/Modules/Platform/Linker/SunOS-GNU-CXX.cmake new file mode 100644 index 0000000..68b2d8c --- /dev/null +++ b/Modules/Platform/Linker/SunOS-GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SunOS-GNU) + +__sunos_linker_gnu(CXX) diff --git a/Modules/Platform/Linker/SunOS-GNU-Fortran.cmake b/Modules/Platform/Linker/SunOS-GNU-Fortran.cmake new file mode 100644 index 0000000..1a7565d --- /dev/null +++ b/Modules/Platform/Linker/SunOS-GNU-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SunOS-GNU) + +__sunos_linker_gnu(Fortran) diff --git a/Modules/Platform/Linker/SunOS-GNU.cmake b/Modules/Platform/Linker/SunOS-GNU.cmake new file mode 100644 index 0000000..693e31a --- /dev/null +++ b/Modules/Platform/Linker/SunOS-GNU.cmake @@ -0,0 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +include(Platform/Linker/GNU) + +macro(__sunos_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +endmacro() diff --git a/Modules/Platform/Linker/SunOS-Solaris-ASM.cmake b/Modules/Platform/Linker/SunOS-Solaris-ASM.cmake new file mode 100644 index 0000000..35ad149 --- /dev/null +++ b/Modules/Platform/Linker/SunOS-Solaris-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SunOS-Solaris) + +__sunos_linker_solaris(ASM) diff --git a/Modules/Platform/Linker/SunOS-Solaris-C.cmake b/Modules/Platform/Linker/SunOS-Solaris-C.cmake new file mode 100644 index 0000000..6251dcc --- /dev/null +++ b/Modules/Platform/Linker/SunOS-Solaris-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SunOS-Solaris) + +__sunos_linker_solaris(C) diff --git a/Modules/Platform/Linker/SunOS-Solaris-CXX.cmake b/Modules/Platform/Linker/SunOS-Solaris-CXX.cmake new file mode 100644 index 0000000..f6e2645 --- /dev/null +++ b/Modules/Platform/Linker/SunOS-Solaris-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SunOS-Solaris) + +__sunos_linker_solaris(CXX) diff --git a/Modules/Platform/Linker/SunOS-Solaris-Fortran.cmake b/Modules/Platform/Linker/SunOS-Solaris-Fortran.cmake new file mode 100644 index 0000000..f55b9f2 --- /dev/null +++ b/Modules/Platform/Linker/SunOS-Solaris-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/SunOS-Solaris) + +__sunos_linker_solaris(Fortran) diff --git a/Modules/Platform/Linker/SunOS-Solaris.cmake b/Modules/Platform/Linker/SunOS-Solaris.cmake new file mode 100644 index 0000000..cf82bf8 --- /dev/null +++ b/Modules/Platform/Linker/SunOS-Solaris.cmake @@ -0,0 +1,27 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +macro(__sunos_linker_solaris lang) + # Features for LINK_LIBRARY generator expression + ## WHOLE_ARCHIVE: Force loading all members of an archive + if (CMAKE_SYSTEM_VERSION VERSION_GREATER "5.10") + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" + "<LINK_ITEM>" + "LINKER:--no-whole-archive") + else() + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-z,allextract" + "<LINK_ITEM>" + "LINKER:-z,defaultextract") + endif() + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) +endmacro() + +endblock() diff --git a/Modules/Platform/Linker/Windows-ASM.cmake b/Modules/Platform/Linker/Windows-ASM.cmake new file mode 100644 index 0000000..bddaed1 --- /dev/null +++ b/Modules/Platform/Linker/Windows-ASM.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(CMAKE_ASM_SIMULATE_ID STREQUAL "MSVC") + # MSVC is the default linker + include(Platform/Linker/Windows-MSVC-ASM) +else() + # GNU is the default linker + include(Platform/Linker/Windows-GNU-ASM) +endif() + +endblock() diff --git a/Modules/Platform/Linker/Windows-C.cmake b/Modules/Platform/Linker/Windows-C.cmake new file mode 100644 index 0000000..4a58407 --- /dev/null +++ b/Modules/Platform/Linker/Windows-C.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC") + # MSVC is the default linker + include(Platform/Linker/Windows-MSVC-C) +else() + # GNU is the default linker + include(Platform/Linker/Windows-GNU-C) +endif() + +endblock() diff --git a/Modules/Platform/Linker/Windows-CUDA.cmake b/Modules/Platform/Linker/Windows-CUDA.cmake new file mode 100644 index 0000000..7e89791 --- /dev/null +++ b/Modules/Platform/Linker/Windows-CUDA.cmake @@ -0,0 +1,5 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# MSVC is the default linker +include(Platform/Linker/Windows-MSVC-CUDA) diff --git a/Modules/Platform/Linker/Windows-CXX.cmake b/Modules/Platform/Linker/Windows-CXX.cmake new file mode 100644 index 0000000..2976851 --- /dev/null +++ b/Modules/Platform/Linker/Windows-CXX.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + # MSVC is the default linker + include(Platform/Linker/Windows-MSVC-CXX) +else() + # GNU is the default linker + include(Platform/Linker/Windows-GNU-CXX) +endif() + +endblock() diff --git a/Modules/Platform/Linker/Windows-Fortran.cmake b/Modules/Platform/Linker/Windows-Fortran.cmake new file mode 100644 index 0000000..928f6d5 --- /dev/null +++ b/Modules/Platform/Linker/Windows-Fortran.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(CMAKE_Fortran_SIMULATE_ID STREQUAL "MSVC") + # MSVC is the default linker + include(Platform/Linker/Windows-MSVC-Fortran) +else() + # GNU is the default linker + include(Platform/Linker/Windows-GNU-Fortran) +endif() + +endblock() diff --git a/Modules/Platform/Linker/Windows-GNU-ASM.cmake b/Modules/Platform/Linker/Windows-GNU-ASM.cmake new file mode 100644 index 0000000..7fac7b1 --- /dev/null +++ b/Modules/Platform/Linker/Windows-GNU-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-GNU) + +__windows_linker_gnu(ASM) diff --git a/Modules/Platform/Linker/Windows-GNU-C.cmake b/Modules/Platform/Linker/Windows-GNU-C.cmake new file mode 100644 index 0000000..833a64d --- /dev/null +++ b/Modules/Platform/Linker/Windows-GNU-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-GNU) + +__windows_linker_gnu(C) diff --git a/Modules/Platform/Linker/Windows-GNU-CXX.cmake b/Modules/Platform/Linker/Windows-GNU-CXX.cmake new file mode 100644 index 0000000..6bc1af0 --- /dev/null +++ b/Modules/Platform/Linker/Windows-GNU-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-GNU) + +__windows_linker_gnu(CXX) diff --git a/Modules/Platform/Linker/Windows-GNU-Fortran.cmake b/Modules/Platform/Linker/Windows-GNU-Fortran.cmake new file mode 100644 index 0000000..4f0c35f --- /dev/null +++ b/Modules/Platform/Linker/Windows-GNU-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-GNU) + +__windows_linker_gnu(Fortran) diff --git a/Modules/Platform/Linker/Windows-GNU-HIP.cmake b/Modules/Platform/Linker/Windows-GNU-HIP.cmake new file mode 100644 index 0000000..4814888 --- /dev/null +++ b/Modules/Platform/Linker/Windows-GNU-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-GNU) + +__windows_linker_gnu(HIP) diff --git a/Modules/Platform/Linker/Windows-GNU.cmake b/Modules/Platform/Linker/Windows-GNU.cmake new file mode 100644 index 0000000..a5c4417 --- /dev/null +++ b/Modules/Platform/Linker/Windows-GNU.cmake @@ -0,0 +1,14 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +include(Platform/Linker/GNU) + +macro(__windows_linker_gnu lang) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +endmacro() diff --git a/Modules/Platform/Linker/Windows-HIP.cmake b/Modules/Platform/Linker/Windows-HIP.cmake new file mode 100644 index 0000000..67b37d1 --- /dev/null +++ b/Modules/Platform/Linker/Windows-HIP.cmake @@ -0,0 +1,15 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +if(CMAKE_HIP_SIMULATE_ID STREQUAL "MSVC") + # MSVC is the default linker + include(Platform/Linker/Windows-MSVC-HIP) +else() + # GNU is the default linker + include(Platform/Linker/Windows-GNU-HIP) +endif() + +endblock() diff --git a/Modules/Platform/Linker/Windows-LLD-ASM.cmake b/Modules/Platform/Linker/Windows-LLD-ASM.cmake new file mode 100644 index 0000000..fbcc55d --- /dev/null +++ b/Modules/Platform/Linker/Windows-LLD-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-LLD) + +__windows_linker_lld(ASM) diff --git a/Modules/Platform/Linker/Windows-LLD-C.cmake b/Modules/Platform/Linker/Windows-LLD-C.cmake new file mode 100644 index 0000000..8efd87e --- /dev/null +++ b/Modules/Platform/Linker/Windows-LLD-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-LLD) + +__windows_linker_lld(C) diff --git a/Modules/Platform/Linker/Windows-LLD-CXX.cmake b/Modules/Platform/Linker/Windows-LLD-CXX.cmake new file mode 100644 index 0000000..7bd3131 --- /dev/null +++ b/Modules/Platform/Linker/Windows-LLD-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-LLD) + +__windows_linker_lld(CXX) diff --git a/Modules/Platform/Linker/Windows-LLD-HIP.cmake b/Modules/Platform/Linker/Windows-LLD-HIP.cmake new file mode 100644 index 0000000..4b04a79 --- /dev/null +++ b/Modules/Platform/Linker/Windows-LLD-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-LLD) + +__windows_linker_lld(HIP) diff --git a/Modules/Platform/Linker/Windows-LLD.cmake b/Modules/Platform/Linker/Windows-LLD.cmake new file mode 100644 index 0000000..f2dde1a --- /dev/null +++ b/Modules/Platform/Linker/Windows-LLD.cmake @@ -0,0 +1,24 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +macro(__windows_linker_lld lang) + # Features for LINK_LIBRARY generator expression + if(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT STREQUAL "GNU") + include(Platform/Linker/Windows-GNU) + __windows_linker_gnu(${lang}) + + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD DEDUPLICATION=ALL) + else() + include(Platform/Linker/Windows-MSVC) + __windows_linker_msvc(${lang}) + endif() +endmacro() + +endblock() diff --git a/Modules/Platform/Linker/Windows-MSVC-ASM.cmake b/Modules/Platform/Linker/Windows-MSVC-ASM.cmake new file mode 100644 index 0000000..df3a64b --- /dev/null +++ b/Modules/Platform/Linker/Windows-MSVC-ASM.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-MSVC) + +__windows_linker_msvc(ASM) diff --git a/Modules/Platform/Linker/Windows-MSVC-C.cmake b/Modules/Platform/Linker/Windows-MSVC-C.cmake new file mode 100644 index 0000000..467c0f3 --- /dev/null +++ b/Modules/Platform/Linker/Windows-MSVC-C.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-MSVC) + +__windows_linker_msvc(C) diff --git a/Modules/Platform/Linker/Windows-MSVC-CUDA.cmake b/Modules/Platform/Linker/Windows-MSVC-CUDA.cmake new file mode 100644 index 0000000..dc3d5e9 --- /dev/null +++ b/Modules/Platform/Linker/Windows-MSVC-CUDA.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-MSVC) + +__windows_linker_msvc(CUDA) diff --git a/Modules/Platform/Linker/Windows-MSVC-CXX.cmake b/Modules/Platform/Linker/Windows-MSVC-CXX.cmake new file mode 100644 index 0000000..f5d3294 --- /dev/null +++ b/Modules/Platform/Linker/Windows-MSVC-CXX.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-MSVC) + +__windows_linker_msvc(CXX) diff --git a/Modules/Platform/Linker/Windows-MSVC-Fortran.cmake b/Modules/Platform/Linker/Windows-MSVC-Fortran.cmake new file mode 100644 index 0000000..b5f99f3 --- /dev/null +++ b/Modules/Platform/Linker/Windows-MSVC-Fortran.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-MSVC) + +__windows_linker_msvc(Fortran) diff --git a/Modules/Platform/Linker/Windows-MSVC-HIP.cmake b/Modules/Platform/Linker/Windows-MSVC-HIP.cmake new file mode 100644 index 0000000..cc2a7da --- /dev/null +++ b/Modules/Platform/Linker/Windows-MSVC-HIP.cmake @@ -0,0 +1,6 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include(Platform/Linker/Windows-MSVC) + +__windows_linker_msvc(HIP) diff --git a/Modules/Platform/Linker/Windows-MSVC.cmake b/Modules/Platform/Linker/Windows-MSVC.cmake new file mode 100644 index 0000000..2eb5713 --- /dev/null +++ b/Modules/Platform/Linker/Windows-MSVC.cmake @@ -0,0 +1,35 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +include_guard() + +block(SCOPE_FOR POLICIES) +cmake_policy(SET CMP0054 NEW) + +# Features for LINK_LIBRARY generator expression +if(MSVC_VERSION GREATER "1900") + ## WHOLE_ARCHIVE: Force loading all members of an archive + set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>") + set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) +endif() + +macro(__windows_linker_msvc lang) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD DEDUPLICATION=ALL) + + # Features for LINK_LIBRARY generator expression + if(DEFINED CMAKE_${lang}_COMPILER_LINKER_VERSION) + if (CMAKE_${lang}_COMPILER_LINKER_VERSION GREATER_EQUAL "14.10") + ## WHOLE_ARCHIVE: Force loading all members of an archive + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>") + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) + set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) + else() + set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED FALSE) + endif() + endif() +endmacro() + +endblock() diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake index 3b5ca59..95debf9 100644 --- a/Modules/Platform/Linux-Intel.cmake +++ b/Modules/Platform/Linux-Intel.cmake @@ -39,6 +39,11 @@ macro(__linux_compiler_intel lang) set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + # FIXME(#26157): compute CMAKE_<LANG>_COMPILER_LINKER* variables + # in the meantime, enforce deactivation of push/pop state linker options + # because xild front-end linker do not support these options even if the platform linker does... + set(_CMAKE_${lang}_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) if(XIAR) diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index a73bbf7..5b61dd6 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -20,32 +20,6 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) endforeach() -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - # Features for LINK_GROUP generator expression ## RESCAN: request the linker to rescan static libraries until there is ## no pending undefined symbols diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake index 892d55b..110212b 100644 --- a/Modules/Platform/NetBSD.cmake +++ b/Modules/Platform/NetBSD.cmake @@ -13,33 +13,6 @@ set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - - # Features for LINK_GROUP generator expression ## RESCAN: request the linker to rescan static libraries until there is ## no pending undefined symbols diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index 25e95e6..e01e892 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -8,21 +8,6 @@ if(CMAKE_SYSTEM MATCHES "SunOS-4") endif() -# Features for LINK_LIBRARY generator expression -## WHOLE_ARCHIVE: Force loading all members of an archive -if (CMAKE_SYSTEM_VERSION VERSION_GREATER "5.10") - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-z,allextract" - "<LINK_ITEM>" - "LINKER:-z,defaultextract") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - - # Features for LINK_GROUP generator expression if (CMAKE_SYSTEM_VERSION VERSION_GREATER "5.9") ## RESCAN: request the linker to rescan static libraries until there is diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index e3725cb..7a05492 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -55,8 +55,6 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") - set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD DEDUPLICATION=ALL) - # linker selection set(CMAKE_${lang}_USING_LINKER_DEFAULT "-fuse-ld=lld-link") set(CMAKE_${lang}_USING_LINKER_SYSTEM "-fuse-ld=link") @@ -135,14 +133,6 @@ macro(__windows_compiler_clang_gnu lang) string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER) set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames") - # Features for LINK_LIBRARY generator expression - if(MSVC_VERSION GREATER "1900") - ## WHOLE_ARCHIVE: Force loading all members of an archive - set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>") - set(CMAKE_${lang}_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) - set(CMAKE_${lang}_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - endif() - enable_language(RC) endmacro() diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 1a4159b..7dc92cd 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -64,32 +64,6 @@ if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]") endif() -# Features for LINK_LIBRARY generator expression -## check linker capabilities -if(NOT DEFINED _CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - execute_process(COMMAND "${CMAKE_LINKER}" --help - OUTPUT_VARIABLE __linker_help - ERROR_VARIABLE __linker_help) - if(__linker_help MATCHES "--push-state" AND __linker_help MATCHES "--pop-state") - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE CACHE INTERNAL "linker supports push/pop state") - else() - set(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED FALSE CACHE INTERNAL "linker supports push/pop state") - endif() - unset(__linker_help) -endif() -## WHOLE_ARCHIVE: Force loading all members of an archive -if(_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED) - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--push-state,--whole-archive" - "<LINK_ITEM>" - "LINKER:--pop-state") -else() - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:--whole-archive" - "<LINK_ITEM>" - "LINKER:--no-whole-archive") -endif() -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - # Features for LINK_GROUP generator expression ## RESCAN: request the linker to rescan static libraries until there is ## no pending undefined symbols diff --git a/Modules/Platform/Windows-IntelLLVM.cmake b/Modules/Platform/Windows-IntelLLVM.cmake index 517d959..ba2cc9c 100644 --- a/Modules/Platform/Windows-IntelLLVM.cmake +++ b/Modules/Platform/Windows-IntelLLVM.cmake @@ -32,14 +32,6 @@ macro(__windows_compiler_intel lang) set(CMAKE_LINK_DEF_FILE_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/DEF:") set(CMAKE_LIBRARY_PATH_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/LIBPATH:") - # Features for LINK_LIBRARY generator expression - if(MSVC_VERSION GREATER "1900") - ## WHOLE_ARCHIVE: Force loading all members of an archive - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>") - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) - set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) - endif() - set(CMAKE_${lang}_LINK_EXECUTABLE "${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <LINK_LIBRARIES> /link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_SHARED_LIBRARY diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index a897e50..189d1fd 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -353,14 +353,6 @@ else() endif() unset(__WINDOWS_MSVC_CMP0141) -# Features for LINK_LIBRARY generator expression -if(MSVC_VERSION GREATER "1900") - ## WHOLE_ARCHIVE: Force loading all members of an archive - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "/WHOLEARCHIVE:<LIBRARY>") - set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) - set(CMAKE_LINK_LIBRARY_WHOLE_ARCHIVE_ATTRIBUTES LIBRARY_TYPE=STATIC DEDUPLICATION=YES OVERRIDE=DEFAULT) -endif() - macro(__windows_compiler_msvc lang) if(NOT MSVC_VERSION LESS 1400) @@ -514,8 +506,6 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_DEPFILE_FORMAT msvc) endif() - set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD DEDUPLICATION=ALL) - # linker selection set(CMAKE_${lang}_USING_LINKER_SYSTEM "${CMAKE_LINKER_LINK}") set(CMAKE_${lang}_USING_LINKER_LLD "${CMAKE_LINKER_LLD}") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 180f9ef..c2ebee9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 30) -set(CMake_VERSION_PATCH 20240722) +set(CMake_VERSION_PATCH 20240724) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index 52eacaa..76cb876 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -15,6 +15,7 @@ #include "cmCPackComponentGroup.h" #include "cmCPackLog.h" +#include "cmGeneratedFileStream.h" #include "cmList.h" #include "cmMakefile.h" #include "cmSystemTools.h" @@ -48,17 +49,19 @@ int cmCPackExternalGenerator::PackageFiles() filename = this->packageFileNames[0]; } - cmsys::ofstream fout(filename.c_str()); - std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter()); + { + cmGeneratedFileStream fout(filename); + std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter()); - Json::Value root(Json::objectValue); + Json::Value root(Json::objectValue); - if (!this->Generator->WriteToJSON(root)) { - return 0; - } + if (!this->Generator->WriteToJSON(root)) { + return 0; + } - if (jout->write(root, &fout)) { - return 0; + if (jout->write(root, &fout)) { + return 0; + } } cmValue packageScript = this->GetOption("CPACK_EXTERNAL_PACKAGE_SCRIPT"); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 9edbce3..309a140 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -531,6 +531,9 @@ bool cmGlobalGenerator::CheckLanguages( // - Make sure the compiler works with a try compile if // CMakeDetermine(LANG) was loaded // +// CMake(LANG)LinkerInformation.cmake +// - loads Platform/Linker/${CMAKE_SYSTEM_NAME}-${LINKER}.cmake +// // Now load a few files that can override values set in any of the above // (PROJECTNAME)Compatibility.cmake // - load any backwards compatibility stuff for current project @@ -955,6 +958,22 @@ void cmGlobalGenerator::EnableLanguage( } } // end if in try compile } // end need test language + + // load linker configuration + std::string langLinkerLoadedVar = + cmStrCat("CMAKE_", lang, "_LINKER_INFORMATION_LOADED"); + if (!mf->GetDefinition(langLinkerLoadedVar)) { + fpath = cmStrCat("Internal/CMake", lang, "LinkerInformation.cmake"); + std::string informationFile = mf->GetModulesFile(fpath); + if (informationFile.empty()) { + cmSystemTools::Error( + cmStrCat("Could not find cmake module file: ", fpath)); + } else if (!mf->ReadListFile(informationFile)) { + cmSystemTools::Error( + cmStrCat("Could not process cmake module file: ", informationFile)); + } + } + // Store the shared library flags so that we can satisfy CMP0018 std::string sharedLibFlagsVar = cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS"); @@ -1811,7 +1811,7 @@ else cmake_c_flags="${cmake_c_flags} ${use_uv_flags}" cmake_cxx_flags="${cmake_cxx_flags} ${use_uv_flags}" else - use_librhash_ldflags="-luv" + use_uv_ldflags="-luv" fi libs="${libs} ${use_uv_ldflags}" fi @@ -1838,7 +1838,7 @@ else use_jsoncpp_ldflags="`pkg-config --libs jsoncpp`" cmake_cxx_flags="${cmake_cxx_flags} ${use_jsoncpp_flags}" else - use_librhash_ldflags="-ljsoncpp" + use_jsoncpp_ldflags="-ljsoncpp" fi libs="${libs} ${use_jsoncpp_ldflags}" fi |