Files
cgal/Installation/cmake/modules/UseCGAL.cmake
T
Laurent Rineau 85eeaca873 Link with the CGAL *target* we possible (instead of linking with the library)
That is a late follow-up to the following commit:

  | commit 12744ab7ff
  | Author: Laurent Rineau <Laurent.Rineau__CGAL@normalesup.org>
  | Date:   Thu Apr 28 13:11:09 2011 +0000
  |
  |     Track dependencies between libraries and examples/demos
  |
  |     With this patch, when CGAL as been configured with WITH_examples and/or
  |     WITH_demos, then the executables of examples and demos depends on the CGAL
  |     libraries. That means if one change a file involved in a CGAL library, and
  |     ask the rebuild of an executable, then the CGAL library will be rebuilt
  |     first.
  |
  | Notes:
  |     r63187 branches/next

Or maybe the bug was re-introduced by recent modifications of our CMake
scripts.
2013-08-20 15:45:29 +02:00

67 lines
2.1 KiB
CMake

#
# UseCGAL.cmake can be included in a project to set the needed compiler and linker
# settings to use CGAL in a program.
#
# The variables used here are defined in the CGALConfig.cmake generated when CGAL was installed.
#
#
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake)
cgal_setup_module_path()
if(NOT USE_CGAL_FILE_INCLUDED)
set(USE_CGAL_FILE_INCLUDED 1)
include(CGAL_Common)
include(CGAL_SetupFlags)
include(CGAL_GeneratorSpecificSettings)
include(CGAL_TweakFindBoost)
set(CGAL_INSTALLED_SCM_BRANCH_NAME ${CGAL_SCM_BRANCH_NAME})
set(CGAL_SCM_BRANCH_NAME "")
if( NOT "${CGAL_INSTALLED_SCM_BRANCH_NAME}" STREQUAL "" )
include(CGAL_SCM)
if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "" )
message ( STATUS "Code taken from Git branch: ${CGAL_SCM_BRANCH_NAME}" )
if ( NOT "${CGAL_SCM_BRANCH_NAME}" STREQUAL "${CGAL_INSTALLED_SCM_BRANCH_NAME}")
message (AUTHOR_WARNING "Branch '${CGAL_SCM_BRANCH_NAME}' does not match branch '${CGAL_INSTALLED_SCM_BRANCH_NAME}' from which CGAL has been installed. Please consider to rebuild CGAL from this branch.")
endif()
endif()
endif()
set( CGAL_LIBRARIES )
foreach ( component ${CGAL_REQUESTED_COMPONENTS} )
use_component( ${component} )
endforeach()
use_essential_libs()
include_directories( "${CMAKE_CURRENT_BINARY_DIR}" )
# need to get variable from cache while compiling CGAL, while in a demo it is set in CGALConfig.cmake
if ( NOT CGAL_LIBRARY )
cache_get(CGAL_LIBRARY)
endif()
if(TARGET CGAL)
add_to_list( CGAL_LIBRARIES CGAL )
else()
add_to_list( CGAL_LIBRARIES ${CGAL_LIBRARY} )
endif()
#message (STATUS "LIB: ${CGAL_LIBRARY}")
#message (STATUS "LIBS: ${CGAL_LIBRARIES}")
include_directories ( ${CGAL_INCLUDE_DIRS})
include_directories ( SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS} )
add_definitions ( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_DEFINITIONS} )
link_directories ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
link_libraries ( ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
endif()