diff options
20 files changed, 92 insertions, 28 deletions
diff --git a/Help/release/dev/find-rustc-importlibs.rst b/Help/release/dev/find-rustc-importlibs.rst new file mode 100644 index 0000000..646afff --- /dev/null +++ b/Help/release/dev/find-rustc-importlibs.rst @@ -0,0 +1,6 @@ +find-rustc-importlibs +--------------------- + +* On Windows, when targeting the MSVC ABI, the :command:`find_library` command + now considers ``.dll.lib`` file names before ``.lib``. This is the default + suffix for DLL import libraries created by Rust toolchains for the MSVC ABI. diff --git a/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst b/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst index c2c2609..d78dd15 100644 --- a/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst +++ b/Help/variable/CMAKE_FIND_LIBRARY_SUFFIXES.rst @@ -5,8 +5,8 @@ Suffixes to append when looking for libraries. This specifies what suffixes to add to library names when the :command:`find_library` command looks for libraries. On Windows systems this -is typically ``.lib`` and, depending on the compiler, ``.dll.a``, ``.a`` -(e.g. GCC and Clang), so when it tries to find the ``foo`` library, it will -look for ``[<prefix>]foo.lib`` and/or ``[<prefix>]foo[.dll].a``, depending on -the compiler used and the ``<prefix>`` specified in the -:variable:`CMAKE_FIND_LIBRARY_PREFIXES`. +is typically ``.lib`` and, depending on the compiler, ``.dll.lib``, ``.dll.a``, +``.a`` (e.g. rustc, GCC, or Clang), so when it tries to find the ``foo`` +library, it will look for ``[<prefix>]foo[.dll].lib`` and/or +``[<prefix>]foo[.dll].a``, depending on the compiler used and the ``<prefix>`` +specified in the :variable:`CMAKE_FIND_LIBRARY_PREFIXES`. diff --git a/Help/variable/LINKER_PREDEFINED_TYPES.txt b/Help/variable/LINKER_PREDEFINED_TYPES.txt index 50dc3df..e8cb19f 100644 --- a/Help/variable/LINKER_PREDEFINED_TYPES.txt +++ b/Help/variable/LINKER_PREDEFINED_TYPES.txt @@ -11,7 +11,7 @@ built-in types. The pre-defined linker types are: (for example, ``SYSTEM`` imply Microsoft linker for all ``MSVC`` compatible compilers). This type is supported for the following platforms/compilers: - * Linux, for ``GNU``, ``Clang`` and ``NVIDIA`` compilers. + * Linux, for ``GNU``, ``Clang``, ``LLVMFlang`` and ``NVIDIA`` compilers. * All Apple variants for ``AppleClang``, ``Clang`` and ``GNU`` compilers. * Windows, for ``MSVC``, ``GNU``, ``Clang`` and ``NVIDIA`` compilers. @@ -19,7 +19,7 @@ built-in types. The pre-defined linker types are: Use the ``LLVM`` linker. This type is supported for the following platforms/compilers: - * Linux, for ``GNU``, ``Clang`` and ``NVIDIA`` compilers. + * Linux, for ``GNU``, ``Clang``, ``LLVMFlang`` and ``NVIDIA`` compilers. * All Apple variants for ``Clang`` and ``AppleClang`` compilers. * Windows, for ``GNU``, ``Clang`` compilers with ``GNU`` front-end and ``CLang``, ``MSVC`` and ``NVIDIA`` compilers with ``MSVC`` front-end. @@ -28,17 +28,19 @@ built-in types. The pre-defined linker types are: Use the ``GNU`` linker. This type is supported for the following platforms/compilers: - * Linux, for ``GNU``, ``Clang`` and ``NVIDIA`` compilers. + * Linux, for ``GNU``, ``Clang``, ``LLVMFlang`` and ``NVIDIA`` compilers. * Windows, for ``GNU``, ``Clang`` compilers with ``GNU`` front-end. ``GOLD`` - Supported on Linux platform for ``GNU``, ``Clang`` and ``NVIDIA`` compilers. + Supported on Linux platform for ``GNU``, ``Clang``, ``LLVMFlang`` and + ``NVIDIA`` compilers. ``MOLD`` Use the `mold linker <https://github.com/rui314/mold>`_. This type is supported on the following platforms: - * Linux platform for ``GNU``, ``Clang`` and ``NVIDIA`` compilers. + * Linux platform for ``GNU``, ``Clang``, ``LLVMFlang`` and ``NVIDIA`` + compilers. * All Apple variants for ``Clang`` and ``AppleClang`` compilers as an alias to ``SOLD``. diff --git a/Modules/CSharpUtilities.cmake b/Modules/CSharpUtilities.cmake index dedb146..b5520ef 100644 --- a/Modules/CSharpUtilities.cmake +++ b/Modules/CSharpUtilities.cmake @@ -64,7 +64,7 @@ Main functions provided by the module Sets source file properties of ``.Designer.cs`` files depending on sibling filenames. Use this, if your CSharp target does **not** use Windows Forms (for Windows Forms use - :command:`csharp_set_designer_cs_properties` instead):: + :command:`csharp_set_windows_forms_properties` instead):: csharp_set_designer_cs_properties([<file1> [<file2> [...]]]) diff --git a/Modules/Compiler/LLVMFlang-Fortran.cmake b/Modules/Compiler/LLVMFlang-Fortran.cmake index d27f094..0a432a9 100644 --- a/Modules/Compiler/LLVMFlang-Fortran.cmake +++ b/Modules/Compiler/LLVMFlang-Fortran.cmake @@ -15,6 +15,9 @@ set(CMAKE_Fortran_POSTPROCESS_FLAG "-ffixed-line-length-72") set(CMAKE_Fortran_COMPILE_OPTIONS_TARGET "--target=") +set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,") +set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",") + if(NOT "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_Fortran_VERBOSE_FLAG "-v") diff --git a/Modules/Platform/Linux-LLVMFlang-Fortran.cmake b/Modules/Platform/Linux-LLVMFlang-Fortran.cmake new file mode 100644 index 0000000..ceecc2f --- /dev/null +++ b/Modules/Platform/Linux-LLVMFlang-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Linux-GNU-Fortran) diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake index 1bf39cf..bc93caa 100644 --- a/Modules/Platform/Windows.cmake +++ b/Modules/Platform/Windows.cmake @@ -14,7 +14,10 @@ set(CMAKE_DL_LIBS "") set(CMAKE_EXTRA_LINK_EXTENSIONS ".targets") set(CMAKE_FIND_LIBRARY_PREFIXES "") -set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES + ".dll.lib" # import library from Rust toolchain for MSVC ABI + ".lib" # static or import library from MSVC tooling + ) # for borland make long command lines are redirected to a file # with the following syntax, see Windows-bcc32.cmake for use diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ed094d2..17690ff 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 28) -set(CMake_VERSION_PATCH 20231208) +set(CMake_VERSION_PATCH 20231209) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 9f0e928..7e1b0e4 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -529,7 +529,7 @@ endforeach() add_RunCMake_test(file-DOWNLOAD) add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(find_file -DMINGW=${MINGW}) -add_RunCMake_test(find_library -DMINGW=${MINGW} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS}) +add_RunCMake_test(find_library -DMINGW=${MINGW} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DMSVC=${MSVC}) add_RunCMake_test(find_package -DMINGW=${MINGW} -DMSYS=${MSYS}) add_RunCMake_test(find_path -DMINGW=${MINGW}) add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) @@ -585,10 +585,10 @@ function(add_RunCMake_test_try_compile) endfunction() add_RunCMake_test_try_compile() -add_RunCMake_test(try_run -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} - -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} - -DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID} - -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID}) +if(CMAKE_Fortran_COMPILER) + list(APPEND try_run_ARGS -DCMake_TEST_Fortran=1) +endif() +add_RunCMake_test(try_run) add_RunCMake_test(set) add_RunCMake_test(variable_watch) add_RunCMake_test(while) diff --git a/Tests/RunCMake/CTestTimeout/TestTimeout.c b/Tests/RunCMake/CTestTimeout/TestTimeout.c index 425548c..da397f8 100644 --- a/Tests/RunCMake/CTestTimeout/TestTimeout.c +++ b/Tests/RunCMake/CTestTimeout/TestTimeout.c @@ -45,7 +45,7 @@ int main(void) #if defined(_WIN32) Sleep((TIMEOUT + 4) * 1000); #elif defined(SIGNAL_IGNORE) -# if defined(__CYGWIN__) || defined(__sun__) +# if defined(__CYGWIN__) || defined(__sun__) || defined(__GNU__) # define ERRNO_IS_EINTR (errno == EINTR || errno == 0) # else # define ERRNO_IS_EINTR (errno == EINTR) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 9777d17..8d9aa6f 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -349,6 +349,9 @@ if("${ninja_version}" VERSION_LESS 1.6) message(WARNING "Ninja is too old; skipping rest of test.") return() endif() +if("${ninja_version}" VERSION_LESS 1.12) + set(maybe_w_dupbuild_err -w dupbuild=err) +endif() set(ninja_output_path_prefixes "sub") if(NOT CMAKE_C_COMPILER_ID STREQUAL "OrangeC") @@ -366,14 +369,14 @@ endforeach(ninja_output_path_prefix) function (run_PreventTargetAliasesDupBuildRule) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PreventTargetAliasesDupBuildRule-build) run_cmake(PreventTargetAliasesDupBuildRule) - run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) + run_ninja("${RunCMake_TEST_BINARY_DIR}" ${maybe_w_dupbuild_err}) endfunction () run_PreventTargetAliasesDupBuildRule() function (run_PreventConfigureFileDupBuildRule) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PreventConfigureFileDupBuildRule-build) run_cmake(PreventConfigureFileDupBuildRule) - run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) + run_ninja("${RunCMake_TEST_BINARY_DIR}" ${maybe_w_dupbuild_err}) endfunction() run_PreventConfigureFileDupBuildRule() @@ -382,7 +385,7 @@ function (run_ChangeBuildType) set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") run_cmake(ChangeBuildType) unset(RunCMake_TEST_OPTIONS) - run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) + run_ninja("${RunCMake_TEST_BINARY_DIR}" ${maybe_w_dupbuild_err}) endfunction() run_ChangeBuildType() diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index 0bed252..f9c8528 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -24,6 +24,10 @@ if(CMAKE_HOST_WIN32 AND MINGW) run_cmake(MSYSTEM_PREFIX) endif() +if(CMAKE_HOST_WIN32 AND MSVC) + run_cmake(Windows-MSVC) +endif() + run_cmake_script(FromScriptMode "-DTEMP_DIR=${RunCMake_BINARY_DIR}/FromScriptMode-temp") run_cmake_with_options(FromPATHEnvDebugVar --debug-find-var=CREATED_LIBRARY) diff --git a/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt b/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt new file mode 100644 index 0000000..598ede5 --- /dev/null +++ b/Tests/RunCMake/find_library/Windows-MSVC-stdout.txt @@ -0,0 +1,2 @@ +-- STATIC_LIBRARY='[^']*/Tests/RunCMake/find_library/Windows-MSVC/static.lib' +-- RUSTC_IMPORT_LIBRARY='[^']*/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.dll.lib' diff --git a/Tests/RunCMake/find_library/Windows-MSVC.cmake b/Tests/RunCMake/find_library/Windows-MSVC.cmake new file mode 100644 index 0000000..485952d --- /dev/null +++ b/Tests/RunCMake/find_library/Windows-MSVC.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +find_library(STATIC_LIBRARY NAMES static NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Windows-MSVC) +message(STATUS "STATIC_LIBRARY='${STATIC_LIBRARY}'") + +find_library(RUSTC_IMPORT_LIBRARY NAMES rustc_import NO_DEFAULT_PATH PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Windows-MSVC) +message(STATUS "RUSTC_IMPORT_LIBRARY='${RUSTC_IMPORT_LIBRARY}'") diff --git a/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.dll.lib b/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.dll.lib new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.dll.lib diff --git a/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.lib b/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.lib new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_library/Windows-MSVC/rustc_import.lib diff --git a/Tests/RunCMake/find_library/Windows-MSVC/static.lib b/Tests/RunCMake/find_library/Windows-MSVC/static.lib new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_library/Windows-MSVC/static.lib diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt index 99248bf..155aff9 100644 --- a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt +++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja-stderr.txt @@ -1 +1,5 @@ -.*ninja: error: .* multiple rules generate.*src.ispc_avx512skx.o.* +ninja: error:([^ +]+multiple rules generate[^ +]+src\.ispc_avx512skx\.o|[^ +]+src\.ispc_avx512skx\.o[^ +]+is defined as an output multiple times) diff --git a/Tests/RunCMake/try_run/Inspect.cmake b/Tests/RunCMake/try_run/Inspect.cmake new file mode 100644 index 0000000..66698d6 --- /dev/null +++ b/Tests/RunCMake/try_run/Inspect.cmake @@ -0,0 +1,22 @@ +enable_language(C) +enable_language(CXX) +if(CMake_TEST_Fortran) + enable_language(Fortran) +endif() + +set(info "") +foreach(var + CMAKE_SYSTEM_NAME + CMAKE_C_COMPILER_ID + CMAKE_C_COMPILER_VERSION + CMAKE_CXX_COMPILER_ID + CMAKE_CXX_COMPILER_VERSION + CMAKE_Fortran_COMPILER_ID + CMAKE_Fortran_COMPILER_VERSION + ) + if(DEFINED ${var}) + string(APPEND info "set(${var} \"${${var}}\")\n") + endif() +endforeach() + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}") diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake index bd7cd9b..7e9b2d1 100644 --- a/Tests/RunCMake/try_run/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake @@ -1,5 +1,16 @@ include(RunCMake) +# Detect information from the toolchain: +# - CMAKE_SYSTEM_NAME +# - CMAKE_C_COMPILER_ID +# - CMAKE_C_COMPILER_VERSION +# - CMAKE_CXX_COMPILER_ID +# - CMAKE_CXX_COMPILER_VERSION +run_cmake_with_options(Inspect + -DCMake_TEST_Fortran=${CMake_TEST_Fortran} + ) +include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake") + run_cmake(BinDirEmpty) run_cmake(BinDirRelative) run_cmake(NoOutputVariable) @@ -22,10 +33,6 @@ endif() if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$" AND - CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") - set (RunCMake_TEST_OPTIONS - -DRunCMake_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID} - -DRunCMake_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID}) + (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 4.3)) run_cmake(LinkerLanguage) - unset (RunCMake_TEST_OPTIONS) endif() |
