Linker: Save linker inspection results with compiler inspection results
Reconfigure `CMake<LANG>Compiler.cmake` again after linker information is detected.
This commit is contained in:
parent
3f5f2b2d49
commit
a9b126b0da
@ -7,10 +7,10 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_RANLIB "@_CMAKE_ASM_COMPILER_RANLIB@")
|
|||||||
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||||
set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
|
set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@")
|
||||||
set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
|
set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@")
|
||||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER "@CMAKE_ASM_COMPILER_LINKER@")
|
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER "@_CMAKE_ASM_COMPILER_LINKER@")
|
||||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_ID "@CMAKE_ASM_COMPILER_LINKER_ID@")
|
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_ID "@_CMAKE_ASM_COMPILER_LINKER_ID@")
|
||||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_VERSION @CMAKE_ASM_COMPILER_LINKER_VERSION@)
|
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_VERSION @_CMAKE_ASM_COMPILER_LINKER_VERSION@)
|
||||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_ASM_COMPILER_LINKER_FRONTEND_VARIANT@)
|
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_FRONTEND_VARIANT @_CMAKE_ASM_COMPILER_LINKER_FRONTEND_VARIANT@)
|
||||||
set(CMAKE_MT "@CMAKE_MT@")
|
set(CMAKE_MT "@CMAKE_MT@")
|
||||||
set(CMAKE_TAPI "@CMAKE_TAPI@")
|
set(CMAKE_TAPI "@CMAKE_TAPI@")
|
||||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
|
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
|
||||||
@ -23,6 +23,6 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@")
|
|||||||
|
|
||||||
set(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
set(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||||
set(CMAKE_ASM@ASM_DIALECT@_LINKER_PREFERENCE 0)
|
set(CMAKE_ASM@ASM_DIALECT@_LINKER_PREFERENCE 0)
|
||||||
set(CMAKE_ASM@ASM_DIALECT@_LINKER_DEPFILE_SUPPORTED @CMAKE_ASM_LINKER_DEPFILE_SUPPORTED@)
|
set(CMAKE_ASM@ASM_DIALECT@_LINKER_DEPFILE_SUPPORTED @_CMAKE_ASM_LINKER_DEPFILE_SUPPORTED@)
|
||||||
|
|
||||||
@CMAKE_ASM_COMPILER_CUSTOM_CODE@
|
@CMAKE_ASM_COMPILER_CUSTOM_CODE@
|
||||||
|
7
Modules/Internal/CMakeInspectASM-ATTLinker.cmake
Normal file
7
Modules/Internal/CMakeInspectASM-ATTLinker.cmake
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Load the generic ASM test file:
|
||||||
|
set(ASM_DIALECT "-ATT")
|
||||||
|
include(Internal/CMakeInspectASMLinker)
|
||||||
|
set(ASM_DIALECT)
|
26
Modules/Internal/CMakeInspectASMLinker.cmake
Normal file
26
Modules/Internal/CMakeInspectASMLinker.cmake
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Re-configure to save learned information.
|
||||||
|
block()
|
||||||
|
foreach(_var IN ITEMS
|
||||||
|
COMPILER
|
||||||
|
COMPILER_ID
|
||||||
|
COMPILER_ARG1
|
||||||
|
COMPILER_ENV_VAR
|
||||||
|
COMPILER_AR
|
||||||
|
COMPILER_RANLIB
|
||||||
|
COMPILER_VERSION
|
||||||
|
COMPILER_LINKER
|
||||||
|
COMPILER_LINKER_ID
|
||||||
|
COMPILER_LINKER_VERSION
|
||||||
|
COMPILER_LINKER_FRONTEND_VARIANT
|
||||||
|
LINKER_DEPFILE_SUPPORTED
|
||||||
|
)
|
||||||
|
set(_CMAKE_ASM_${_var} "${CMAKE_ASM${ASM_DIALECT}_${_var}}")
|
||||||
|
endforeach()
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeASM${ASM_DIALECT}Compiler.cmake
|
||||||
|
@ONLY)
|
||||||
|
endblock()
|
7
Modules/Internal/CMakeInspectASM_MARMASMLinker.cmake
Normal file
7
Modules/Internal/CMakeInspectASM_MARMASMLinker.cmake
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Load the generic ASM test file:
|
||||||
|
set(ASM_DIALECT "_MARMASM")
|
||||||
|
include(Internal/CMakeInspectASMLinker)
|
||||||
|
set(ASM_DIALECT)
|
7
Modules/Internal/CMakeInspectASM_MASMLinker.cmake
Normal file
7
Modules/Internal/CMakeInspectASM_MASMLinker.cmake
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Load the generic ASM test file:
|
||||||
|
set(ASM_DIALECT "_MASM")
|
||||||
|
include(Internal/CMakeInspectASMLinker)
|
||||||
|
set(ASM_DIALECT)
|
7
Modules/Internal/CMakeInspectASM_NASMLinker.cmake
Normal file
7
Modules/Internal/CMakeInspectASM_NASMLinker.cmake
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Load the generic ASM test file:
|
||||||
|
set(ASM_DIALECT "_NASM")
|
||||||
|
include(Internal/CMakeInspectASMLinker)
|
||||||
|
set(ASM_DIALECT)
|
8
Modules/Internal/CMakeInspectCLinker.cmake
Normal file
8
Modules/Internal/CMakeInspectCLinker.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Re-configure to save learned information.
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake
|
||||||
|
@ONLY)
|
8
Modules/Internal/CMakeInspectCUDALinker.cmake
Normal file
8
Modules/Internal/CMakeInspectCUDALinker.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Re-configure to save learned information.
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake
|
||||||
|
@ONLY)
|
8
Modules/Internal/CMakeInspectCXXLinker.cmake
Normal file
8
Modules/Internal/CMakeInspectCXXLinker.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Re-configure to save learned information.
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake
|
||||||
|
@ONLY)
|
8
Modules/Internal/CMakeInspectFortranLinker.cmake
Normal file
8
Modules/Internal/CMakeInspectFortranLinker.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Re-configure to save learned information.
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake
|
||||||
|
@ONLY)
|
8
Modules/Internal/CMakeInspectHIPLinker.cmake
Normal file
8
Modules/Internal/CMakeInspectHIPLinker.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Re-configure to save learned information.
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_ROOT}/Modules/CMakeHIPCompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeHIPCompiler.cmake
|
||||||
|
@ONLY)
|
8
Modules/Internal/CMakeInspectOBJCLinker.cmake
Normal file
8
Modules/Internal/CMakeInspectOBJCLinker.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Re-configure to save learned information.
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_ROOT}/Modules/CMakeOBJCCompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCCompiler.cmake
|
||||||
|
@ONLY)
|
8
Modules/Internal/CMakeInspectOBJCXXLinker.cmake
Normal file
8
Modules/Internal/CMakeInspectOBJCXXLinker.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Re-configure to save learned information.
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_ROOT}/Modules/CMakeOBJCXXCompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCXXCompiler.cmake
|
||||||
|
@ONLY)
|
8
Modules/Internal/CMakeInspectSwiftLinker.cmake
Normal file
8
Modules/Internal/CMakeInspectSwiftLinker.cmake
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file LICENSE.rst or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
# Re-configure to save learned information.
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in
|
||||||
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake
|
||||||
|
@ONLY)
|
@ -963,9 +963,9 @@ void cmGlobalGenerator::EnableLanguage(
|
|||||||
} // end if in try compile
|
} // end if in try compile
|
||||||
} // end need test language
|
} // end need test language
|
||||||
|
|
||||||
// load linker configuration, if required
|
// load linker configuration, if required
|
||||||
if (mf->GetDefinition(cmStrCat("CMAKE_", lang, "_USE_LINKER_INFORMATION"))
|
if (mf->IsOn(cmStrCat("CMAKE_", lang, "_COMPILER_WORKS")) &&
|
||||||
.IsOn()) {
|
mf->IsOn(cmStrCat("CMAKE_", lang, "_USE_LINKER_INFORMATION"))) {
|
||||||
std::string langLinkerLoadedVar =
|
std::string langLinkerLoadedVar =
|
||||||
cmStrCat("CMAKE_", lang, "_LINKER_INFORMATION_LOADED");
|
cmStrCat("CMAKE_", lang, "_LINKER_INFORMATION_LOADED");
|
||||||
if (!mf->GetDefinition(langLinkerLoadedVar)) {
|
if (!mf->GetDefinition(langLinkerLoadedVar)) {
|
||||||
@ -982,6 +982,18 @@ void cmGlobalGenerator::EnableLanguage(
|
|||||||
"Could not process cmake module file: ", informationFile));
|
"Could not process cmake module file: ", informationFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needTestLanguage[lang]) {
|
||||||
|
if (!this->CMakeInstance->GetIsInTryCompile()) {
|
||||||
|
std::string testLang =
|
||||||
|
cmStrCat("Internal/CMakeInspect", lang, "Linker.cmake");
|
||||||
|
std::string ifpath = mf->GetModulesFile(testLang);
|
||||||
|
if (!mf->ReadListFile(ifpath)) {
|
||||||
|
cmSystemTools::Error(
|
||||||
|
cmStrCat("Could not find cmake module file: ", testLang));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the shared library flags so that we can satisfy CMP0018
|
// Store the shared library flags so that we can satisfy CMP0018
|
||||||
|
Loading…
Reference in New Issue
Block a user