diff options
22 files changed, 188 insertions, 70 deletions
diff --git a/Help/variable/CMAKE_APPLE_SILICON_PROCESSOR.rst b/Help/variable/CMAKE_APPLE_SILICON_PROCESSOR.rst index ad297c3..0d5ccd1 100644 --- a/Help/variable/CMAKE_APPLE_SILICON_PROCESSOR.rst +++ b/Help/variable/CMAKE_APPLE_SILICON_PROCESSOR.rst @@ -8,8 +8,7 @@ CMake what architecture to use for :variable:`CMAKE_HOST_SYSTEM_PROCESSOR`. The value must be either ``arm64`` or ``x86_64``. The value of this variable should never be modified by project code. -It is meant to be set by a toolchain file specified by the -:variable:`CMAKE_TOOLCHAIN_FILE` variable, or as a cache entry -provided by the user, e.g. via ``-DCMAKE_APPLE_SILICON_PROCESSOR=...``. +It is meant to be set as a cache entry provided by the user, +e.g. via ``-DCMAKE_APPLE_SILICON_PROCESSOR=...``. See also the :envvar:`CMAKE_APPLE_SILICON_PROCESSOR` environment variable. diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index ff178f6..e87a16b 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -99,6 +99,8 @@ else() set(_CMAKE_LINKER_NAMES "ld.lld") endif() list(APPEND _CMAKE_AR_NAMES "llvm-ar") + list(APPEND _CMAKE_RANLIB_NAMES "llvm-ranlib") + list(APPEND _CMAKE_STRIP_NAMES "llvm-strip") list(APPEND _CMAKE_NM_NAMES "llvm-nm") list(APPEND _CMAKE_OBJDUMP_NAMES "llvm-objdump") list(APPEND _CMAKE_OBJCOPY_NAMES "llvm-objcopy") diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 0a3db4c..0f547e9 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -62,6 +62,9 @@ PRINT *, 'INFO:compiler[Cray]' # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) +# if defined(_RELEASE_PATCHLEVEL) +# define COMPILER_VERSION_PATCH DEC(_RELEASE_PATCHLEVEL) +# endif #elif defined(__G95__) PRINT *, 'INFO:compiler[G95]' # define COMPILER_VERSION_MAJOR DEC(__G95__) diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index 2ee0622..faaff7b 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -1349,15 +1349,21 @@ function(cpack_rpm_generate_package) continue() endif() - file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE + file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES true RELATIVE "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}" "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*") foreach(f_ IN LISTS files_for_move_) - get_filename_component(dir_path_ "${f_}" DIRECTORY) set(src_file_ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/${f_}") + if(IS_DIRECTORY "${src_file_}") + file(MAKE_DIRECTORY "${WDIR}/${f_}") + continue() + endif() + + get_filename_component(dir_path_ "${f_}" DIRECTORY) + # check that we are not overriding an existing file that doesn't # match the file that we want to copy if(EXISTS "${src_file_}" AND EXISTS "${WDIR}/${f_}") diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake index 6116ae1..50f0620 100644 --- a/Modules/Platform/Android-Initialize.cmake +++ b/Modules/Platform/Android-Initialize.cmake @@ -25,6 +25,56 @@ endif() set(CMAKE_BUILD_TYPE_INIT "RelWithDebInfo") +if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) + # Tell CMake not to search host sysroots for headers/libraries. + + # All paths added to CMAKE_SYSTEM_*_PATH below will be rerooted under + # CMAKE_FIND_ROOT_PATH. This is set because: + # 1. Users may structure their libraries in a way similar to NDK. When they do that, + # they can simply append another path to CMAKE_FIND_ROOT_PATH. + # 2. CMAKE_FIND_ROOT_PATH must be non-empty for CMAKE_FIND_ROOT_PATH_MODE_* == ONLY + # to be meaningful. https://github.com/android-ndk/ndk/issues/890 + list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot") + + # Allow users to override these values in case they want more strict behaviors. + # For example, they may want to prevent the NDK's libz from being picked up so + # they can use their own. + # https://github.com/android-ndk/ndk/issues/517 + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + endif() + + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + endif() + + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + endif() + + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + endif() + + # Don't search paths in PATH environment variable. + if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH) + set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) + endif() + + # Allows CMake to find headers in the architecture-specific include directories. + set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_ANDROID_ARCH_TRIPLE}") + + # Instructs CMake to search the correct API level for libraries. + # Besides the paths like <root>/<prefix>/lib/<arch>, cmake also searches <root>/<prefix>. + # So we can add the API level specific directory directly. + # https://github.com/android/ndk/issues/929 + list(PREPEND CMAKE_SYSTEM_PREFIX_PATH + "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SYSTEM_VERSION}" + ) + + list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin") +endif() + # Skip sysroot selection if the NDK has a unified toolchain. if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) return() diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake index e4b9a09..6944e32 100644 --- a/Modules/Platform/Android.cmake +++ b/Modules/Platform/Android.cmake @@ -35,56 +35,6 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1) return() endif() -if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED) - # Tell CMake not to search host sysroots for headers/libraries. - - # All paths added to CMAKE_SYSTEM_*_PATH below will be rerooted under - # CMAKE_FIND_ROOT_PATH. This is set because: - # 1. Users may structure their libraries in a way similar to NDK. When they do that, - # they can simply append another path to CMAKE_FIND_ROOT_PATH. - # 2. CMAKE_FIND_ROOT_PATH must be non-empty for CMAKE_FIND_ROOT_PATH_MODE_* == ONLY - # to be meaningful. https://github.com/android-ndk/ndk/issues/890 - list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot") - - # Allow users to override these values in case they want more strict behaviors. - # For example, they may want to prevent the NDK's libz from being picked up so - # they can use their own. - # https://github.com/android-ndk/ndk/issues/517 - if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - endif() - - if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) - endif() - - if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - endif() - - if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) - set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - endif() - - # Don't search paths in PATH environment variable. - if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH) - set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) - endif() - - # Allows CMake to find headers in the architecture-specific include directories. - set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_ANDROID_ARCH_TRIPLE}") - - # Instructs CMake to search the correct API level for libraries. - # Besides the paths like <root>/<prefix>/lib/<arch>, cmake also searches <root>/<prefix>. - # So we can add the API level specific directory directly. - # https://github.com/android/ndk/issues/929 - list(PREPEND CMAKE_SYSTEM_PREFIX_PATH - "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SYSTEM_VERSION}" - ) - - list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin") -endif() - # Include the NDK hook. # It can be used by NDK to inject necessary fixes for an earlier cmake. if(CMAKE_ANDROID_NDK) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3798d8c..9893e4b 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 20) -set(CMake_VERSION_PATCH 20210330) +set(CMake_VERSION_PATCH 20210401) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index c6b6184..cac60e1 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -3,9 +3,10 @@ #include "cmExportTryCompileFileGenerator.h" #include <map> -#include <memory> #include <utility> +#include <cm/memory> + #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorTarget.h" @@ -66,7 +67,15 @@ std::string cmExportTryCompileFileGenerator::FindTargets( cmGeneratorExpression ge; - cmGeneratorExpressionDAGChecker dagChecker(tgt, propName, nullptr, nullptr); + std::unique_ptr<cmGeneratorExpressionDAGChecker> parentDagChecker; + if (propName == "INTERFACE_LINK_OPTIONS") { + // To please constraint checks of DAGChecker, this property must have + // LINK_OPTIONS property as parent + parentDagChecker = cm::make_unique<cmGeneratorExpressionDAGChecker>( + tgt, "LINK_OPTIONS", nullptr, nullptr); + } + cmGeneratorExpressionDAGChecker dagChecker(tgt, propName, nullptr, + parentDagChecker.get()); std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop); diff --git a/Source/cmGccDepfileLexerHelper.cxx b/Source/cmGccDepfileLexerHelper.cxx index c782bcd..afa8e9b 100644 --- a/Source/cmGccDepfileLexerHelper.cxx +++ b/Source/cmGccDepfileLexerHelper.cxx @@ -12,6 +12,8 @@ #include "LexerParser/cmGccDepfileLexer.h" #ifdef _WIN32 +# include <cctype> + # include "cmsys/Encoding.h" #endif @@ -123,11 +125,21 @@ void cmGccDepfileLexerHelper::sanitizeContent() if (it->rules.empty()) { it = this->Content.erase(it); } else { - // Remove empty paths + // Remove empty paths and normalize windows paths for (auto pit = it->paths.begin(); pit != it->paths.end();) { if (pit->empty()) { pit = it->paths.erase(pit); } else { +#if defined(_WIN32) + // Unescape the colon following the drive letter. + // Some versions of GNU compilers can escape this character. + // c\:\path must be transformed to c:\path + if (pit->size() >= 3 && std::toupper((*pit)[0]) >= 'A' && + std::toupper((*pit)[0]) <= 'Z' && (*pit)[1] == '\\' && + (*pit)[2] == ':') { + pit->erase(1, 1); + } +#endif ++pit; } } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d3c9959..365f8b8 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3655,13 +3655,58 @@ std::vector<BT<std::string>> wrapOptions( return result; } - if (wrapperFlag.empty() || cmHasLiteralPrefix(options.front(), "LINKER:")) { - // nothing specified or LINKER wrapper, insert elements as is + if (wrapperFlag.empty()) { + // nothing specified, insert elements as is result.reserve(options.size()); for (std::string& o : options) { result.emplace_back(std::move(o), bt); } - } else { + return result; + } + + for (std::vector<std::string>::size_type index = 0; index < options.size(); + index++) { + if (cmHasLiteralPrefix(options[index], "LINKER:")) { + // LINKER wrapper specified, insert elements as is + result.emplace_back(std::move(options[index]), bt); + continue; + } + if (cmHasLiteralPrefix(options[index], "-Wl,")) { + // replace option by LINKER wrapper + result.emplace_back(options[index].replace(0, 4, "LINKER:"), bt); + continue; + } + if (cmHasLiteralPrefix(options[index], "-Xlinker=")) { + // replace option by LINKER wrapper + result.emplace_back(options[index].replace(0, 9, "LINKER:"), bt); + continue; + } + if (options[index] == "-Xlinker") { + // replace option by LINKER wrapper + if (index + 1 < options.size()) { + result.emplace_back("LINKER:" + options[++index], bt); + } else { + result.emplace_back(std::move(options[index]), bt); + } + continue; + } + + // collect all options which must be transformed + std::vector<std::string> opts; + while (index < options.size()) { + if (!cmHasLiteralPrefix(options[index], "LINKER:") && + !cmHasLiteralPrefix(options[index], "-Wl,") && + !cmHasLiteralPrefix(options[index], "-Xlinker")) { + opts.emplace_back(std::move(options[index++])); + } else { + --index; + break; + } + } + if (opts.empty()) { + continue; + } + if (!wrapperSep.empty()) { if (concatFlagAndArgs) { // insert flag elements except last one @@ -3670,24 +3715,23 @@ std::vector<BT<std::string>> wrapOptions( } // concatenate last flag element and all list values // in one option - result.emplace_back(wrapperFlag.back() + cmJoin(options, wrapperSep), - bt); + result.emplace_back(wrapperFlag.back() + cmJoin(opts, wrapperSep), bt); } else { for (std::string const& i : wrapperFlag) { result.emplace_back(i, bt); } // concatenate all list values in one option - result.emplace_back(cmJoin(options, wrapperSep), bt); + result.emplace_back(cmJoin(opts, wrapperSep), bt); } } else { // prefix each element of list with wrapper if (concatFlagAndArgs) { - std::transform(options.begin(), options.end(), options.begin(), + std::transform(opts.begin(), opts.end(), opts.begin(), [&wrapperFlag](std::string const& o) -> std::string { return wrapperFlag.back() + o; }); } - for (std::string& o : options) { + for (std::string& o : opts) { for (auto i = wrapperFlag.begin(), e = concatFlagAndArgs ? wrapperFlag.end() - 1 : wrapperFlag.end(); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index cf04799..4d974a8 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -3926,7 +3926,7 @@ bool SystemTools::FileIsFullPath(const char* in_name) bool SystemToolsStatic::FileIsFullPath(const char* in_name, size_t len) { -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) // On Windows, the name must be at least two characters long. if (len < 2) { return false; diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index 4d1b46c..9409d1b 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -10,7 +10,7 @@ #endif /* Configure support for this platform. */ -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) # define KWSYS_TERMINAL_SUPPORT_CONSOLE #endif #if !defined(_WIN32) diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake index 936e4ed..1dc7084 100644 --- a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake @@ -9,7 +9,7 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm") set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm") - set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") + set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so;/empty_dir") set(EXPECTED_FILE_4_COMPONENT "debuginfo") set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake index 60e9038..064539e 100644 --- a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake @@ -30,6 +30,9 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) install(TARGETS test_lib DESTINATION bas COMPONENT libs) + + # test that we correctly handle empty dir in non main component + install(DIRECTORY DESTINATION empty_dir COMPONENT libs) elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") set(CPACK_COMPONENTS_ALL applications) diff --git a/Tests/RunCMake/GenEx-DEVICE_LINK/DEVICE_LINK-try_compile.cmake b/Tests/RunCMake/GenEx-DEVICE_LINK/DEVICE_LINK-try_compile.cmake new file mode 100644 index 0000000..281f8aa --- /dev/null +++ b/Tests/RunCMake/GenEx-DEVICE_LINK/DEVICE_LINK-try_compile.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(demo INTERFACE IMPORTED) +set_property(TARGET demo PROPERTY INTERFACE_LINK_OPTIONS "$<DEVICE_LINK:>") + +set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) +try_compile(result "${CMAKE_CURRENT_BINARY_DIR}/tc" "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" + LINK_LIBRARIES demo) diff --git a/Tests/RunCMake/GenEx-DEVICE_LINK/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-DEVICE_LINK/RunCMakeTest.cmake index 1e44601..80633e2 100644 --- a/Tests/RunCMake/GenEx-DEVICE_LINK/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-DEVICE_LINK/RunCMakeTest.cmake @@ -12,6 +12,7 @@ run_cmake(DEVICE_LINK-target_compile_options) run_cmake(DEVICE_LINK-target_include_directories) run_cmake(DEVICE_LINK-target_link_libraries) run_cmake(DEVICE_LINK-target_link_directories) +run_cmake(DEVICE_LINK-try_compile) if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") run_cmake(DEVICE_LINK-link_depends) endif() diff --git a/Tests/RunCMake/GenEx-HOST_LINK/HOST_LINK-try_compile.cmake b/Tests/RunCMake/GenEx-HOST_LINK/HOST_LINK-try_compile.cmake new file mode 100644 index 0000000..f221ff1 --- /dev/null +++ b/Tests/RunCMake/GenEx-HOST_LINK/HOST_LINK-try_compile.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(demo INTERFACE IMPORTED) +set_property(TARGET demo PROPERTY INTERFACE_LINK_OPTIONS "$<HOST_LINK:>") + +set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) +try_compile(result "${CMAKE_CURRENT_BINARY_DIR}/tc" "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" + LINK_LIBRARIES demo) diff --git a/Tests/RunCMake/GenEx-HOST_LINK/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-HOST_LINK/RunCMakeTest.cmake index 329a7c6..9e3eeec 100644 --- a/Tests/RunCMake/GenEx-HOST_LINK/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenEx-HOST_LINK/RunCMakeTest.cmake @@ -12,6 +12,7 @@ run_cmake(HOST_LINK-target_compile_options) run_cmake(HOST_LINK-target_include_directories) run_cmake(HOST_LINK-target_link_libraries) run_cmake(HOST_LINK-target_link_directories) +run_cmake(HOST_LINK-try_compile) if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") run_cmake(HOST_LINK-link_depends) endif() diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake index 8ef13f9..a707383 100644 --- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -17,6 +17,9 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) endif() + if (RunCMake_GENERATOR MATCHES "Ninja") + set(VERBOSE -- -v) + endif() run_cmake(LINK_OPTIONS) @@ -56,6 +59,10 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") run_cmake_target(genex_DEVICE_LINK CMP0105_OLD LinkOptions_CMP0105_OLD --config Release) run_cmake_target(genex_DEVICE_LINK CMP0105_NEW LinkOptions_CMP0105_NEW --config Release) run_cmake_target(genex_DEVICE_LINK device LinkOptions_device --config Release) + + if (RunCMake_GENERATOR MATCHES "(Ninja|Unix Makefiles)") + run_cmake_target(genex_DEVICE_LINK host_link_options LinkOptions_host_link_options --config Release ${VERBOSE}) + endif() endif() run_cmake_target(genex_DEVICE_LINK no_device LinkOptions_no_device --config Release) diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake new file mode 100644 index 0000000..31ffe7f --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5") + set (RunCMake_TEST_FAILED "Not found expected '-Xlinker=OPT1 -Xlinker=OPT2 -Xlinker=OPT3 -Xlinker=OPT4 -Xlinker=OPT5'.") +endif() diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-result.txt b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-host_link_options-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake index 0126080..a53ab20 100644 --- a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake @@ -1,6 +1,10 @@ enable_language(C) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE) +set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE) + set (obj "${CMAKE_C_OUTPUT_EXTENSION}") if(BORLAND) set(pre -) @@ -43,6 +47,10 @@ if (CMake_TEST_CUDA) set_property(TARGET LinkOptions_device PROPERTY CUDA_SEPARABLE_COMPILATION ON) target_link_options(LinkOptions_device PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}> $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>) + + add_executable(LinkOptions_host_link_options LinkOptionsDevice.cu) + set_property(TARGET LinkOptions_host_link_options PROPERTY CUDA_SEPARABLE_COMPILATION ON) + target_link_options(LinkOptions_host_link_options PRIVATE -Wl,OPT1 -Xlinker=OPT2 "SHELL:-Xlinker OPT3" "SHELL:LINKER:OPT4 LINKER:OPT5") endif() add_executable(LinkOptions_no_device LinkOptionsDevice.cu) |