summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-11-21 12:37:04 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-11-21 12:37:11 (GMT)
commit8b83d1fdffeab9d24946552a9b8252c2e0dc4570 (patch)
tree35978ac09ee59cbaa29b7702aeb2c2768be07648 /Tests
parent3d48c5404cde1ca5f9956d9587f7d5b134a696eb (diff)
parent19d92d5e6e79448337aface8ed40df78240d674b (diff)
downloadCMake-8b83d1fdffeab9d24946552a9b8252c2e0dc4570.zip
CMake-8b83d1fdffeab9d24946552a9b8252c2e0dc4570.tar.gz
CMake-8b83d1fdffeab9d24946552a9b8252c2e0dc4570.tar.bz2
Merge topic 'find-boost-test-version'
19d92d5e6e FindBoost: provide the version in x.y.z format 186f69cf26 FindBoost: test version variables Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2638
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FindBoost/Test/CMakeLists.txt3
-rw-r--r--Tests/FindBoost/Test/main.cxx17
2 files changed, 19 insertions, 1 deletions
diff --git a/Tests/FindBoost/Test/CMakeLists.txt b/Tests/FindBoost/Test/CMakeLists.txt
index 663f414..39e92c1 100644
--- a/Tests/FindBoost/Test/CMakeLists.txt
+++ b/Tests/FindBoost/Test/CMakeLists.txt
@@ -13,6 +13,9 @@ if(NOT Boost_PROGRAM_OPTIONS_FOUND)
message(FATAL_ERROR "Optional Boost component \"program_options\" not found which is unexpected")
endif(NOT Boost_PROGRAM_OPTIONS_FOUND)
+add_definitions(-DCMAKE_EXPECTED_BOOST_VERSION="${Boost_VERSION}")
+add_definitions(-DCMAKE_EXPECTED_BOOST_VERSION_COMPONENTS="${Boost_VERSION_STRING}")
+
add_executable(test_boost_tgt main.cxx)
target_link_libraries(test_boost_tgt
Boost::dynamic_linking
diff --git a/Tests/FindBoost/Test/main.cxx b/Tests/FindBoost/Test/main.cxx
index 6e8b5da..50ddadf 100644
--- a/Tests/FindBoost/Test/main.cxx
+++ b/Tests/FindBoost/Test/main.cxx
@@ -20,5 +20,20 @@ int main()
boost::thread foo(threadmain);
foo.join();
- return 0;
+ int version = BOOST_VERSION;
+ int major = version / 100000;
+ int minor = version / 100 % 1000;
+ int patch = version % 100;
+ char version_string[100];
+ snprintf(version_string, sizeof(version_string), "%d.%d.%d", major, minor,
+ patch);
+ printf("Found Boost version %s, expected version %s\n", version_string,
+ CMAKE_EXPECTED_BOOST_VERSION_COMPONENTS);
+ int ret = strcmp(version_string, CMAKE_EXPECTED_BOOST_VERSION_COMPONENTS);
+ char raw_version_string[100];
+ snprintf(raw_version_string, sizeof(raw_version_string), "%d",
+ BOOST_VERSION);
+ printf("Found Boost version %s, expected version %s\n", raw_version_string,
+ CMAKE_EXPECTED_BOOST_VERSION);
+ return ret | strcmp(raw_version_string, CMAKE_EXPECTED_BOOST_VERSION);
}