mirror of https://github.com/CGAL/cgal
Add CGALConfigVersion.cmake, and CTest tests
This commit is contained in:
parent
c6df90f943
commit
f4581c2b13
|
|
@ -0,0 +1 @@
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/Installation/lib/cmake/CGAL/CGALConfigVersion.cmake)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfigVersion.cmake)
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
set(CGAL_MAJOR_VERSION 4)
|
||||||
|
set(CGAL_MINOR_VERSION 14)
|
||||||
|
set(CGAL_BUGFIX_VERSION 4)
|
||||||
|
set(CGAL_VERSION_PUBLIC_RELEASE_NAME "CGAL-4.14.4")
|
||||||
|
|
||||||
|
if (CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0)
|
||||||
|
set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUGFIX_VERSION}")
|
||||||
|
else()
|
||||||
|
set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(PACKAGE_VERSION ${CGAL_CREATED_VERSION_NUM})
|
||||||
|
|
||||||
|
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
|
else()
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||||
|
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||||
|
set(PACKAGE_VERSION_EXACT TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
@ -102,3 +102,37 @@ else()
|
||||||
message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
|
message(STATUS "NOTICE: This program requires the CGAL library, and will not be compiled.")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
function(CGAL_installation_test_find_package_version mode)
|
||||||
|
set(EXACT)
|
||||||
|
if(mode STREQUAL "less")
|
||||||
|
MATH(EXPR CGAL_MAJOR_VERSION "${CGAL_MAJOR_VERSION} - 1")
|
||||||
|
endif()
|
||||||
|
if(mode STREQUAL "greater" OR mode STREQUAL "fail-exact")
|
||||||
|
MATH(EXPR CGAL_MINOR_VERSION "${CGAL_MINOR_VERSION} + 1")
|
||||||
|
endif()
|
||||||
|
if(mode STREQUAL "exact" OR mode STREQUAL "fail-exact")
|
||||||
|
set(EXACT "EXACT ")
|
||||||
|
endif()
|
||||||
|
if (CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0)
|
||||||
|
set(VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUGFIX_VERSION}")
|
||||||
|
else()
|
||||||
|
set(VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}")
|
||||||
|
endif()
|
||||||
|
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/build-test_find_package_version_${mode}")
|
||||||
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build-test_find_package_version_${mode})
|
||||||
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_find_package_version_${mode})
|
||||||
|
configure_file(test_find_package.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/test_find_package_version_${mode}/CMakeLists.txt)
|
||||||
|
add_test(NAME test_find_package_version_${mode}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_BINARY_DIR}/test_find_package_version_${mode} -B ${CMAKE_CURRENT_BINARY_DIR}/build-test_find_package_version_${mode})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
CGAL_installation_test_find_package_version(less)
|
||||||
|
CGAL_installation_test_find_package_version(equal)
|
||||||
|
CGAL_installation_test_find_package_version(greater)
|
||||||
|
CGAL_installation_test_find_package_version(exact)
|
||||||
|
CGAL_installation_test_find_package_version(fail-exact)
|
||||||
|
set_tests_properties(
|
||||||
|
test_find_package_version_greater
|
||||||
|
test_find_package_version_fail-exact
|
||||||
|
PROPERTIES WILL_FAIL TRUE)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||||
|
project( test_find_package_${mode} )
|
||||||
|
find_package(CGAL ${VERSION} ${EXACT}REQUIRED
|
||||||
|
PATHS ${CGAL_DIR}
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
NO_PACKAGE_ROOT_PATH
|
||||||
|
NO_CMAKE_PATH
|
||||||
|
NO_CMAKE_ENVIRONMENT_PATH
|
||||||
|
NO_SYSTEM_ENVIRONMENT_PATH
|
||||||
|
NO_CMAKE_PACKAGE_REGISTRY
|
||||||
|
NO_CMAKE_BUILDS_PATH
|
||||||
|
NO_CMAKE_SYSTEM_PATH
|
||||||
|
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue