From 9bf486f84ca333ccba65b5ffcb6f3e1bdcba3ecf Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Mon, 3 May 2021 17:58:02 +0200 Subject: ECMSetupVersion: phase out deprecated *_VERSION_STRING CMake variables --- tests/ECMSetupVersionTest/CMakeLists.txt | 3 +++ .../CMakeLists.txt | 17 +++++++++++++++++ .../new_explicit_simple_no_version_string_vars/main.c | 4 ++++ .../CMakeLists.txt | 16 ++++++++++++++++ .../new_project_simple_no_version_string_vars/main.c | 4 ++++ .../old_simple_no_version_string_vars/CMakeLists.txt | 16 ++++++++++++++++ .../old_simple_no_version_string_vars/main.c | 4 ++++ tests/ECMSetupVersionTest/version_helpers.cmake | 4 +++- 8 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tests/ECMSetupVersionTest/new_explicit_simple_no_version_string_vars/CMakeLists.txt create mode 100644 tests/ECMSetupVersionTest/new_explicit_simple_no_version_string_vars/main.c create mode 100644 tests/ECMSetupVersionTest/new_project_simple_no_version_string_vars/CMakeLists.txt create mode 100644 tests/ECMSetupVersionTest/new_project_simple_no_version_string_vars/main.c create mode 100644 tests/ECMSetupVersionTest/old_simple_no_version_string_vars/CMakeLists.txt create mode 100644 tests/ECMSetupVersionTest/old_simple_no_version_string_vars/main.c (limited to 'tests') diff --git a/tests/ECMSetupVersionTest/CMakeLists.txt b/tests/ECMSetupVersionTest/CMakeLists.txt index b0845e57..cfda7c91 100644 --- a/tests/ECMSetupVersionTest/CMakeLists.txt +++ b/tests/ECMSetupVersionTest/CMakeLists.txt @@ -14,6 +14,7 @@ macro(add_version_test NAME COMMAND) endmacro() add_version_test(old_simple dummy) +add_version_test(old_simple_no_version_string_vars dummy) add_version_test(old_soversion dummy) add_version_test(old_version_file dummy) add_version_test(old_version_file_abspath dummy) @@ -27,6 +28,7 @@ if(CMAKE_MAJOR_VERSION GREATER 2) add_version_test(new_explicit_header check_header) add_version_test(new_explicit_header_abspath check_header) add_version_test(new_explicit_simple dummy) + add_version_test(new_explicit_simple_no_version_string_vars dummy) add_version_test(new_explicit_soversion dummy) add_version_test(new_explicit_version_file dummy) add_version_test(new_explicit_version_file_abspath dummy) @@ -34,6 +36,7 @@ if(CMAKE_MAJOR_VERSION GREATER 2) add_version_test(new_project_header_abspath check_header) add_version_test(new_project_header_prefix check_header) add_version_test(new_project_simple dummy) + add_version_test(new_project_simple_no_version_string_vars dummy) add_version_test(new_project_simple_prefix dummy) add_version_test(new_project_soversion dummy) add_version_test(new_project_soversion_prefix dummy) diff --git a/tests/ECMSetupVersionTest/new_explicit_simple_no_version_string_vars/CMakeLists.txt b/tests/ECMSetupVersionTest/new_explicit_simple_no_version_string_vars/CMakeLists.txt new file mode 100644 index 00000000..8d370906 --- /dev/null +++ b/tests/ECMSetupVersionTest/new_explicit_simple_no_version_string_vars/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.0.0) + +project(new_explicit_simple VERSION 1.5.6.7) + +# trigger *_VERSION_STRING vars no longer being set +set(ECM_GLOBAL_FIND_VERSION 5.83) +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules) +include(ECMSetupVersion) + +ecm_setup_version(2.3.4 VARIABLE_PREFIX Foo) + +include(../version_helpers.cmake) +project_version_var_checks(1.5.6.7) +version_var_checks(Foo 2.3.4) +assert_var_num_value(Foo_SOVERSION 2) + +add_executable(dummy main.c) diff --git a/tests/ECMSetupVersionTest/new_explicit_simple_no_version_string_vars/main.c b/tests/ECMSetupVersionTest/new_explicit_simple_no_version_string_vars/main.c new file mode 100644 index 00000000..c13815ce --- /dev/null +++ b/tests/ECMSetupVersionTest/new_explicit_simple_no_version_string_vars/main.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/tests/ECMSetupVersionTest/new_project_simple_no_version_string_vars/CMakeLists.txt b/tests/ECMSetupVersionTest/new_project_simple_no_version_string_vars/CMakeLists.txt new file mode 100644 index 00000000..2bb390a9 --- /dev/null +++ b/tests/ECMSetupVersionTest/new_project_simple_no_version_string_vars/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.0.0) + +project(new_project_simple VERSION 2.3.4) + +# trigger *_VERSION_STRING vars no longer being set +set(ECM_GLOBAL_FIND_VERSION 5.83) +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules) +include(ECMSetupVersion) + +ecm_setup_version(PROJECT) + +include(../version_helpers.cmake) +# NB: name comes from project() command +standard_version_var_checks(new_project_simple 2.3.4) + +add_executable(dummy main.c) diff --git a/tests/ECMSetupVersionTest/new_project_simple_no_version_string_vars/main.c b/tests/ECMSetupVersionTest/new_project_simple_no_version_string_vars/main.c new file mode 100644 index 00000000..c13815ce --- /dev/null +++ b/tests/ECMSetupVersionTest/new_project_simple_no_version_string_vars/main.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/tests/ECMSetupVersionTest/old_simple_no_version_string_vars/CMakeLists.txt b/tests/ECMSetupVersionTest/old_simple_no_version_string_vars/CMakeLists.txt new file mode 100644 index 00000000..5b3a9b09 --- /dev/null +++ b/tests/ECMSetupVersionTest/old_simple_no_version_string_vars/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.5) + +cmake_policy(SET CMP0048 OLD) +project(old_simple) + +# trigger *_VERSION_STRING vars no longer being set +set(ECM_GLOBAL_FIND_VERSION 5.83) +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules) +include(ECMSetupVersion) + +ecm_setup_version(2.3.4 VARIABLE_PREFIX Foo) + +include(../version_helpers.cmake) +standard_version_var_checks(Foo 2.3.4) + +add_executable(dummy main.c) diff --git a/tests/ECMSetupVersionTest/old_simple_no_version_string_vars/main.c b/tests/ECMSetupVersionTest/old_simple_no_version_string_vars/main.c new file mode 100644 index 00000000..c13815ce --- /dev/null +++ b/tests/ECMSetupVersionTest/old_simple_no_version_string_vars/main.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/tests/ECMSetupVersionTest/version_helpers.cmake b/tests/ECMSetupVersionTest/version_helpers.cmake index de0a36b5..6254322f 100644 --- a/tests/ECMSetupVersionTest/version_helpers.cmake +++ b/tests/ECMSetupVersionTest/version_helpers.cmake @@ -43,7 +43,9 @@ endmacro() macro(version_var_checks prefix version) assert_var_str_value(${prefix}_VERSION "${version}") - assert_var_str_value(${prefix}_VERSION_STRING "${version}") + if("${ECM_GLOBAL_FIND_VERSION}" VERSION_LESS "5.83.0") + assert_var_str_value(${prefix}_VERSION_STRING "${version}") + endif() if("${version}" MATCHES "^([0-9]+)") assert_var_num_value(${prefix}_VERSION_MAJOR ${CMAKE_MATCH_1}) endif() -- cgit v1.2.1