@@ -102,3 +102,37 @@ else()
102
102
message (STATUS "NOTICE: This program requires the CGAL library, and will not be compiled." )
103
103
104
104
endif ()
105
+
106
+ function (CGAL_installation_test_find_package_version mode)
107
+ set (EXACT)
108
+ if (mode STREQUAL "less" )
109
+ MATH (EXPR CGAL_MAJOR_VERSION "${CGAL_MAJOR_VERSION} - 1" )
110
+ endif ()
111
+ if (mode STREQUAL "greater" OR mode STREQUAL "fail-exact" )
112
+ MATH (EXPR CGAL_MINOR_VERSION "${CGAL_MINOR_VERSION} + 1" )
113
+ endif ()
114
+ if (mode STREQUAL "exact" OR mode STREQUAL "fail-exact" )
115
+ set (EXACT "EXACT " )
116
+ endif ()
117
+ if (CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0)
118
+ set (VERSION "${CGAL_MAJOR_VERSION} .${CGAL_MINOR_VERSION} .${CGAL_BUGFIX_VERSION} " )
119
+ else ()
120
+ set (VERSION "${CGAL_MAJOR_VERSION} .${CGAL_MINOR_VERSION} " )
121
+ endif ()
122
+ file (REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR} /build-test_find_package_version_${mode} " )
123
+ file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /build -test_find_package_version_${mode} )
124
+ file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /test_find_package_version_${mode} )
125
+ configure_file (test_find_package.cmake.in ${CMAKE_CURRENT_BINARY_DIR} /test_find_package_version_${mode} /CMakeLists.txt)
126
+ add_test (NAME test_find_package_version_${mode}
127
+ COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_BINARY_DIR} /test_find_package_version_${mode} -B ${CMAKE_CURRENT_BINARY_DIR} /build -test_find_package_version_${mode} )
128
+ endfunction ()
129
+
130
+ CGAL_installation_test_find_package_version(less )
131
+ CGAL_installation_test_find_package_version(equal )
132
+ CGAL_installation_test_find_package_version(greater )
133
+ CGAL_installation_test_find_package_version(exact)
134
+ CGAL_installation_test_find_package_version(fail-exact)
135
+ set_tests_properties (
136
+ test_find_package_version_greater
137
+ test_find_package_version_fail-exact
138
+ PROPERTIES WILL_FAIL TRUE )
0 commit comments