mirror of https://github.com/CGAL/cgal
77 lines
2.4 KiB
CMake
77 lines
2.4 KiB
CMake
# Try to find the CGAL libraries
|
|
# CGAL_FOUND - system has CGAL lib
|
|
# CGAL_INCLUDE_DIR - the CGAL include directory
|
|
# CGAL_LIBRARIES_DIR - the CGAL libraries directory
|
|
# CGAL_LIBRARIES - the CGAL libraries
|
|
# CGAL_CMAKE_MODULE_PATH - the directory containing CGAL related CMake stuff
|
|
|
|
# CGAL_ROOT - set to the enviroment variable CGALROOT, IF defined (can be empty)
|
|
|
|
# If found, the folder containing the CGAL-specific CMake stuff is added to CMAKE_MODULE_PATH
|
|
|
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
|
|
|
if ( NOT CGAL_INCLUDE_DIRS OR NOT CGAL_LIBRARIES_DIRS OR NOT CGAL_CMAKE_MODULE_PATH )
|
|
|
|
set(CGAL_ROOT $ENV{CGALROOT})
|
|
|
|
if(CGAL_ROOT)
|
|
file(TO_CMAKE_PATH ${CGAL_ROOT} CGAL_ROOT)
|
|
endif()
|
|
|
|
find_path(CGAL_INCLUDE_DIR
|
|
NAMES CGAL/basic.h
|
|
PATHS ../../include ${CGAL_ROOT}/include
|
|
DOC "The directories containing include files for CGAL"
|
|
)
|
|
|
|
find_path(CGAL_CMAKE_MODULE_PATH CGALcommon.cmake
|
|
PATHS ../../cmake/modules ${CGAL_ROOT}/cmake/modules ${CMAKE_MODULE_PATH}
|
|
DOC "The directories containing CGAL CMake stuff"
|
|
)
|
|
|
|
if ( "${CMAKE_GENERATOR}" MATCHES "Visual Studio" )
|
|
|
|
if ( "${CMAKE_GENERATOR}" MATCHES "2003" )
|
|
set(TOOLSET "-vc71")
|
|
elseif ( "${CMAKE_GENERATOR}" MATCHES "2005" )
|
|
set(TOOLSET "-vc80")
|
|
elseif ( "${CMAKE_GENERATOR}" MATCHES "2008" )
|
|
set(TOOLSET "-vc90")
|
|
endif()
|
|
|
|
find_path(CGAL_LIBRARIES_DIR
|
|
NAMES "cgal${TOOLSET}-mt.lib" "cgal${TOOLSET}-mt-gd.lib" "cgal${TOOLSET}-mt-o.lib" "cgal${TOOLSET}-mt-g.lib"
|
|
PATHS ../../lib ${CGAL_ROOT}/lib
|
|
DOC "Path to CGAL and third-party libraries"
|
|
)
|
|
|
|
set(CGAL_LIBRARIES "")
|
|
|
|
else()
|
|
|
|
find_library(CGAL_LIBRARIES NAMES CGAL
|
|
PATHS ../../lib ${CGAL_ROOT}/lib
|
|
DOC "CGAL libraries"
|
|
)
|
|
|
|
get_filename_component(CGAL_LIBRARIES_DIR ${CGAL_LIBRARIES} PATH)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if ( CGAL_INCLUDE_DIR AND CGAL_LIBRARIES_DIR AND CGAL_CMAKE_MODULE_PATH )
|
|
set( CGAL_FOUND TRUE )
|
|
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CGAL_CMAKE_MODULE_PATH})
|
|
else()
|
|
if ( CGAL_FIND_REQUIRED)
|
|
message(FATAL_ERROR "Could NOT find CGAL")
|
|
else()
|
|
if (NOT CGAL_FIND_QUIETLY)
|
|
message(STATUS "Could NOT find CGAL")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|