diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2021-03-26 15:27:18 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2021-03-26 15:27:18 (GMT) |
commit | 1d8e3a1e770ae4aed921eefffaceb70b1fd73701 (patch) | |
tree | e92bba9d4420302b016e6491ced6cf45a3d5add9 /Tests/RunCMake | |
parent | 18a2e863852e6b9f918940698952b75e5e17dcd8 (diff) | |
download | CMake-1d8e3a1e770ae4aed921eefffaceb70b1fd73701.zip CMake-1d8e3a1e770ae4aed921eefffaceb70b1fd73701.tar.gz CMake-1d8e3a1e770ae4aed921eefffaceb70b1fd73701.tar.bz2 |
UseSWIG: Use standard library name conventions for csharp language
Fixes: #21542
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake | 10 | ||||
-rw-r--r-- | Tests/RunCMake/UseSWIG/CMP0122-NEW.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake | 10 | ||||
-rw-r--r-- | Tests/RunCMake/UseSWIG/CMP0122-OLD.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt | 10 | ||||
-rw-r--r-- | Tests/RunCMake/UseSWIG/CMP0122-WARN.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/UseSWIG/CMP0122-common.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/UseSWIG/RunCMakeTest.cmake | 4 |
8 files changed, 51 insertions, 0 deletions
diff --git a/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake b/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake new file mode 100644 index 0000000..a26c278 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-NEW-check.cmake @@ -0,0 +1,10 @@ + +cmake_policy(VERSION 3.1) + +file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CMP0122-library-name.txt" prefixes) + +list(GET prefixes 0 std_prefix) +list(GET prefixes 1 lib_prefix) +if (NOT std_prefix STREQUAL lib_prefix) + string (APPEND RunCMake_TEST_FAILED "\nFound prefix: '${lib_prefix}', expected: '${std_prefix}'.") +endif() diff --git a/Tests/RunCMake/UseSWIG/CMP0122-NEW.cmake b/Tests/RunCMake/UseSWIG/CMP0122-NEW.cmake new file mode 100644 index 0000000..fecb7db --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0122 NEW) +include(CMP0122-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake b/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake new file mode 100644 index 0000000..01657d0 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-OLD-check.cmake @@ -0,0 +1,10 @@ + +cmake_policy(VERSION 3.1) + +file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CMP0122-library-name.txt" prefixes) + +list(GET prefixes 1 lib_prefix) +if (lib_prefix) + # prefix must be empty + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix: '${lib_prefix}'.") +endif() diff --git a/Tests/RunCMake/UseSWIG/CMP0122-OLD.cmake b/Tests/RunCMake/UseSWIG/CMP0122-OLD.cmake new file mode 100644 index 0000000..a787b68 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0122 OLD) +include(CMP0122-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt new file mode 100644 index 0000000..37c4fbd --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at .*/Modules/UseSWIG.cmake:[0-9]+ \(message\): + Policy CMP0122 is not set: UseSWIG use standard library name conventions + for csharp language\. Run "cmake --help-policy CMP0122" for policy details\. + Use the cmake_policy command to set the policy and suppress this warning\. + +Call Stack \(most recent call first\): + CMP0122-common.cmake:9 \(swig_add_library\) + CMP0122-WARN.cmake:1 \(include\) + CMakeLists.txt:3 \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/UseSWIG/CMP0122-WARN.cmake b/Tests/RunCMake/UseSWIG/CMP0122-WARN.cmake new file mode 100644 index 0000000..5d571aa --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-WARN.cmake @@ -0,0 +1 @@ +include(CMP0122-common.cmake) diff --git a/Tests/RunCMake/UseSWIG/CMP0122-common.cmake b/Tests/RunCMake/UseSWIG/CMP0122-common.cmake new file mode 100644 index 0000000..be880ec --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0122-common.cmake @@ -0,0 +1,12 @@ + +cmake_policy(SET CMP0078 NEW) +cmake_policy(SET CMP0086 NEW) + +set(SWIG_EXECUTABLE "swig") +set(SWIG_DIR "/swig") +include(UseSWIG) + +swig_add_library(example LANGUAGE csharp TYPE SHARED SOURCES example.i) + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/CMP0122-library-name.txt" + CONTENT "${CMAKE_SHARED_LIBRARY_PREFIX}\n$<TARGET_FILE_PREFIX:example>\n") diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake index 6acf719..c7a118f 100644 --- a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake @@ -23,3 +23,7 @@ if (CMake_TEST_FindPython) run_cmake_target(CMP0086-NEW build example) endif() + +run_cmake(CMP0122-WARN) +run_cmake(CMP0122-OLD) +run_cmake(CMP0122-NEW) |