summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeCCompilerId.c.in4
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in4
-rw-r--r--Modules/CMakeFortranCompilerId.F.in2
-rw-r--r--Modules/Compiler/TI-C.cmake6
-rw-r--r--Modules/FindHDF5.cmake8
-rw-r--r--Source/cmExportBuildFileGenerator.cxx3
-rw-r--r--Source/cmExportInstallFileGenerator.cxx3
-rw-r--r--Source/cmInstallCommand.cxx19
-rw-r--r--Source/cmTargetExport.h2
-rw-r--r--Tests/RunCMake/export/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/export/SeparateNamelinkExport.cmake16
-rw-r--r--Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake19
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake1
13 files changed, 70 insertions, 18 deletions
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 2f6bdb4..8ba6abc 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -26,7 +26,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
-#if defined(__CRAYXE) || defined(__CRAYXC)
+#if defined(_CRAYC) || defined(__cray__)
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
@@ -77,7 +77,7 @@ int main(int argc, char* argv[])
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
-#if defined(__CRAYXE) || defined(__CRAYXC)
+#if defined(_CRAYC) || defined(__cray__)
require += info_cray[argc];
#endif
require += info_language_dialect_default[argc];
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index a743ce7..672fff8 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -20,7 +20,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
-#if defined(__CRAYXE) || defined(__CRAYXC)
+#if defined(_CRAYC) || defined(__cray__)
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
@@ -76,7 +76,7 @@ int main(int argc, char* argv[])
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
-#if defined(__CRAYXE) || defined(__CRAYXC)
+#if defined(_CRAYC) || defined(__cray__)
require += info_cray[argc];
#endif
require += info_language_dialect_default[argc];
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 30f8d4c..7e8828b 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -108,7 +108,7 @@
#else
PRINT *, 'INFO:compiler[]'
#endif
-#if defined(__CRAYXE) || defined(__CRAYXC)
+#if defined(_CRAYFTN)
PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]'
#endif
diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake
index 3c97afb..bd88989 100644
--- a/Modules/Compiler/TI-C.cmake
+++ b/Modules/Compiler/TI-C.cmake
@@ -26,7 +26,7 @@ else()
endif()
-if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}}")
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}")
set(CMAKE_C90_STANDARD_COMPILE_OPTION "--c89" "--strict_ansi")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--c89" "--relaxed_ansi")
@@ -34,8 +34,8 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_$
set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99" "--strict_ansi")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99" "--relaxed_ansi")
- if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} AND
- CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}}")
+ if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID} AND
+ CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "--c11" "--strict_ansi")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--c11" "--relaxed_ansi")
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 0a92c71..0c1e93b 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -1026,7 +1026,7 @@ if (HDF5_FOUND)
# Error if we still don't have the location.
message(SEND_ERROR
"HDF5 was found, but a different variable was set which contains "
- "its location.")
+ "the location of the `hdf5::${hdf5_target_name}` library.")
endif ()
add_library("hdf5::${hdf5_target_name}" UNKNOWN IMPORTED)
string(REPLACE "-D" "" _hdf5_definitions "${HDF5_${hdf5_lang}_DEFINITIONS}")
@@ -1057,12 +1057,14 @@ if (HDF5_FOUND)
continue ()
endif ()
+ set(hdf5_alt_target_name "")
if (hdf5_lang STREQUAL "C")
set(hdf5_target_name "hdf5_hl")
elseif (hdf5_lang STREQUAL "CXX")
set(hdf5_target_name "hdf5_hl_cpp")
elseif (hdf5_lang STREQUAL "Fortran")
set(hdf5_target_name "hdf5_hl_fortran")
+ set(hdf5_alt_target_name "hdf5hl_fortran")
else ()
continue ()
endif ()
@@ -1081,11 +1083,13 @@ if (HDF5_FOUND)
set(_hdf5_location "${HDF5_${hdf5_lang}_HL_LIBRARY}")
elseif (DEFINED "HDF5_${hdf5_lang}_LIBRARY_${hdf5_target_name}")
set(_hdf5_location "${HDF5_${hdf5_lang}_LIBRARY_${hdf5_target_name}}")
+ elseif (hdf5_alt_target_name AND DEFINED "HDF5_${hdf5_lang}_LIBRARY_${hdf5_alt_target_name}")
+ set(_hdf5_location "${HDF5_${hdf5_lang}_LIBRARY_${hdf5_alt_target_name}}")
else ()
# Error if we still don't have the location.
message(SEND_ERROR
"HDF5 was found, but a different variable was set which contains "
- "its location.")
+ "the location of the `hdf5::${hdf5_target_name}` library.")
endif ()
add_library("hdf5::${hdf5_target_name}" UNKNOWN IMPORTED)
string(REPLACE "-D" "" _hdf5_definitions "${HDF5_${hdf5_lang}_HL_DEFINITIONS}")
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index dd700c5..1a31ae4 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -288,6 +288,9 @@ void cmExportBuildFileGenerator::GetTargets(
if (this->ExportSet) {
for (std::unique_ptr<cmTargetExport> const& te :
this->ExportSet->GetTargetExports()) {
+ if (te->NamelinkOnly) {
+ continue;
+ }
targets.push_back(te->TargetName);
}
return;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 987ec9e..0b9b183 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -42,6 +42,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::string sep;
for (std::unique_ptr<cmTargetExport> const& te :
this->IEGen->GetExportSet()->GetTargetExports()) {
+ if (te->NamelinkOnly) {
+ continue;
+ }
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
sep = " ";
if (this->ExportedTargets.insert(te->Target).second) {
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index b99e6a3..ff08ee4 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -461,6 +461,13 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
std::unique_ptr<cmInstallFilesGenerator> publicHeaderGenerator;
std::unique_ptr<cmInstallFilesGenerator> resourceGenerator;
+ // Avoid selecting default destinations for PUBLIC_HEADER and
+ // PRIVATE_HEADER if any artifacts are specified.
+ bool artifactsSpecified = false;
+
+ // Track whether this is a namelink-only rule.
+ bool namelinkOnly = false;
+
auto addTargetExport = [&]() {
// Add this install rule to an export if one was specified.
if (!exports.empty()) {
@@ -475,20 +482,13 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
te->ObjectsGenerator = objectGenerator.get();
te->InterfaceIncludeDirectories =
cmJoin(includesArgs.GetIncludeDirs(), ";");
-
+ te->NamelinkOnly = namelinkOnly;
helper.Makefile->GetGlobalGenerator()
->GetExportSets()[exports]
.AddTargetExport(std::move(te));
}
};
- // Avoid selecting default destinations for PUBLIC_HEADER and
- // PRIVATE_HEADER if any artifacts are specified.
- bool artifactsSpecified = false;
-
- // Track whether this is a namelink-only rule.
- bool namelinkOnly = false;
-
switch (target.GetType()) {
case cmStateEnums::SHARED_LIBRARY: {
// Shared libraries are handled differently on DLL and non-DLL
@@ -497,6 +497,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (target.IsDLLPlatform()) {
// When in namelink only mode skip all libraries on Windows.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
+ namelinkOnly = true;
addTargetExport();
continue;
}
@@ -529,6 +530,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (target.IsFrameworkOnApple()) {
// When in namelink only mode skip frameworks.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
+ namelinkOnly = true;
addTargetExport();
continue;
}
@@ -574,6 +576,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (target.IsFrameworkOnApple()) {
// When in namelink only mode skip frameworks.
if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) {
+ namelinkOnly = true;
addTargetExport();
continue;
}
diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h
index cb4d8da..1e38d84 100644
--- a/Source/cmTargetExport.h
+++ b/Source/cmTargetExport.h
@@ -31,4 +31,6 @@ public:
cmInstallFilesGenerator* HeaderGenerator;
std::string InterfaceIncludeDirectories;
///@}
+
+ bool NamelinkOnly = false;
};
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index 95c8d5c..0e6020f 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -17,3 +17,4 @@ run_cmake(DependOnNotExport)
run_cmake(DependOnDoubleExport)
run_cmake(UnknownExport)
run_cmake(NamelinkOnlyExport)
+run_cmake(SeparateNamelinkExport)
diff --git a/Tests/RunCMake/export/SeparateNamelinkExport.cmake b/Tests/RunCMake/export/SeparateNamelinkExport.cmake
new file mode 100644
index 0000000..b006aea
--- /dev/null
+++ b/Tests/RunCMake/export/SeparateNamelinkExport.cmake
@@ -0,0 +1,16 @@
+enable_language(CXX)
+add_library(foo SHARED empty.cpp)
+install(TARGETS foo EXPORT fooExport
+ RUNTIME DESTINATION bin
+ LIBRARY
+ DESTINATION lib
+ COMPONENT runtime
+ NAMELINK_SKIP
+)
+install(TARGETS foo EXPORT fooExport
+ LIBRARY
+ DESTINATION lib
+ COMPONENT development
+ NAMELINK_ONLY
+)
+export(EXPORT fooExport FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
diff --git a/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake b/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake
new file mode 100644
index 0000000..5c6fa10
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake
@@ -0,0 +1,19 @@
+enable_language(C)
+add_library(foo SHARED empty.c)
+install(TARGETS foo EXPORT fooExport
+ RUNTIME DESTINATION bin
+ LIBRARY
+ DESTINATION lib
+ COMPONENT runtime
+ NAMELINK_SKIP
+)
+install(TARGETS foo EXPORT fooExport
+ LIBRARY
+ DESTINATION lib
+ COMPONENT development
+ NAMELINK_ONLY
+)
+install(EXPORT fooExport
+ DESTINATION "lib/cmake/"
+ FILE "foo.cmake"
+)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 5aab88c..d64d88b 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -78,6 +78,7 @@ run_cmake(TARGETS-DESTINATION-bad)
run_cmake(EXPORT-OldIFace)
run_cmake(EXPORT-UnknownExport)
run_cmake(EXPORT-NamelinkOnly)
+run_cmake(EXPORT-SeparateNamelink)
run_cmake(CMP0062-OLD)
run_cmake(CMP0062-NEW)
run_cmake(CMP0062-WARN)