From 04bb34b01872572cb5a38b39c3da676bcd635102 Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Sat, 8 Dec 2007 03:26:39 +0000 Subject: [PATCH] General fixes --- .gitattributes | 1 + CMake/CMakeLists.txt | 28 ++++++---- CMake/cmake/modules/CheckCXXFileRuns.cmake | 42 ++++++++------- .../modules/FindBOOST_PROGRAM_OPTIONS.cmake | 34 ++++++------ CMake/cmake/modules/FindCGAL.cmake | 29 ++++++---- CMake/cmake/modules/FindCGAL_CORE.cmake | 50 +++++++++-------- CMake/cmake/modules/FindCORE.cmake | 22 ++++---- CMake/cmake/modules/FindGMP.cmake | 24 +++++---- CMake/cmake/modules/FindGMPXX.cmake | 28 +++++----- CMake/cmake/modules/FindMPFR.cmake | 18 ++++--- CMake/cmake/modules/FindTAUCS.cmake | 53 +++++++++++++++++++ CMake/cmake/modules/FindZLIB.cmake | 14 ++--- 12 files changed, 218 insertions(+), 125 deletions(-) create mode 100644 CMake/cmake/modules/FindTAUCS.cmake diff --git a/.gitattributes b/.gitattributes index 7273f48122a..456d95ee273 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1515,6 +1515,7 @@ CMake/cmake/modules/FindCORE.cmake -text CMake/cmake/modules/FindGMP.cmake -text CMake/cmake/modules/FindGMPXX.cmake -text CMake/cmake/modules/FindMPFR.cmake -text +CMake/cmake/modules/FindTAUCS.cmake -text CMake/cmake/modules/FindZLIB.cmake -text CMake/cmake/modules/LogCMakeVariables.cmake -text CMake/cmake/modules/MacroOptionalFindPackage.cmake -text diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt index fff5145d1ba..376448b3cea 100644 --- a/CMake/CMakeLists.txt +++ b/CMake/CMakeLists.txt @@ -19,8 +19,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR) # CGAL version number set(CGAL_MAJOR_VERSION 3) -set(CGAL_MINOR_VERSION 3) -set(CGAL_BUILD_VERSION 212) +set(CGAL_MINOR_VERSION 4) +set(CGAL_BUILD_VERSION 1) set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}") @@ -37,6 +37,7 @@ set(CMAKE_COLORMAKEFILE ON) # TODO: build static and/or dynamic CGAL libraries? # CGAL 3.2 builds only static libraries on Windows and static + dynamic on Unix. if (WIN32) + set(AUTO_LINK_ENABLED TRUE) set(BUILD_SHARED_LIBS OFF) endif (WIN32) @@ -141,7 +142,7 @@ else(CORE_FOUND) macro_optional_find_package(CGAL_CORE) if(CGAL_CORE_FOUND) # Compile CORE shipped with CGAL - add_subdirectory(src/Core) + add_subdirectory(src/CGALCore) set(CGAL_3RD_PARTY_INCLUDE_DIRS ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_CORE_INCLUDE_DIR}) set(CGAL_3RD_PARTY_LIBRARIES ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_CORE_LIBRARIES}) @@ -179,7 +180,13 @@ if(QT_FOUND) set(CGAL_USE_QT 1) endif(QT_FOUND) -# TODO: Write FindTAUCS.cmake +# Find TAUCS +macro_optional_find_package(TAUCS) +if(TAUCS_FOUND) + set(CGAL_3RD_PARTY_INCLUDE_DIRS ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${TAUCS_INCLUDE_DIR}) + set(CGAL_3RD_PARTY_LIBRARIES ${CGAL_3RD_PARTY_LIBRARIES} ${TAUCS_LIBRARIES}) + set(CGAL_USE_TAUCS 1) +endif() # Find OpenGL macro_optional_find_package(OpenGL) @@ -207,9 +214,6 @@ INSTALL(FILES CHANGES # Install headers add_subdirectory(include/CGAL) -if (CGAL_USE_CGAL_CORE) - add_subdirectory(include/CORE) -endif (CGAL_USE_CGAL_CORE) # Install scripts add_subdirectory(scripts) @@ -243,10 +247,10 @@ FOREACH(config_test_cpp ${all_config_tests}) # compiler_config.h should #define ${config_test_name} is the test failed # => flip ${config_test_name} if (${config_test_name}) - set(${config_test_name} 0) - else (${config_test_name}) - set(${config_test_name} 1) - endif (${config_test_name}) + set(${config_test_name} 0) + else() + set(${config_test_name} 1) + endif() ENDFOREACH(config_test_cpp ${all_config_tests}) #----------------------------------------------------------------------------- @@ -259,6 +263,8 @@ CONFIGURE_FILE(${CGAL_SOURCE_DIR}/compiler_config.h.in ${CGAL_BINARY_DIR}/include/CGAL/compiler_config.h @ONLY IMMEDIATE) INSTALL(FILES ${CGAL_BINARY_DIR}/include/CGAL/compiler_config.h DESTINATION ${CGAL_INCLUDE_INSTALL_DIR}/CGAL) +message(FATAL_ERROR "stop") + #----------------------------------------------------------------------------- # CGAL requires special compiler flags on some platforms. # 1) set settings to compile CGAL libraries. diff --git a/CMake/cmake/modules/CheckCXXFileRuns.cmake b/CMake/cmake/modules/CheckCXXFileRuns.cmake index 358a9210b94..78915102191 100644 --- a/CMake/cmake/modules/CheckCXXFileRuns.cmake +++ b/CMake/cmake/modules/CheckCXXFileRuns.cmake @@ -16,22 +16,20 @@ # KDE4's CheckCSourceRuns.cmake MACRO(CHECK_CXX_FILE_RUNS FILE VAR TEST) - IF("${VAR}" MATCHES "^${VAR}$") + if("${VAR}" MATCHES "^${VAR}$") # Set compiler settings - SET(MACRO_CHECK_FUNCTION_DEFINITIONS - "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") - IF(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - ELSE(CMAKE_REQUIRED_LIBRARIES) + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + else() SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) + endif() + + if(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else() SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES) - ENDIF(CMAKE_REQUIRED_INCLUDES) + endif() # Try to compile and run the test #MESSAGE(STATUS "Performing Test ${TEST}") @@ -44,20 +42,26 @@ MACRO(CHECK_CXX_FILE_RUNS FILE VAR TEST) "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" OUTPUT_VARIABLE OUTPUT) + # Extract the test description + FILE( STRINGS $(FILE) $(TEST_DESC) REGEXP "//|" ) + + # Appends the corresponding #cmakedefine entry to compiler_config.h.in + FILE( APPEND ${CGAL_SOURCE_DIR}/compiler_config.h.in $(TEST_DESC) ) + # if it did not compile make the return value fail code of 1 - IF(NOT ${VAR}_COMPILED) + if(NOT ${VAR}_COMPILED) SET(${VAR} 1) - ENDIF(NOT ${VAR}_COMPILED) + endif() # if the return value was 0 then it worked SET(result_var ${${VAR}}) - IF("${result_var}" EQUAL 0) + if("${result_var}" EQUAL 0) SET(${VAR} 1 CACHE INTERNAL "Test ${TEST}") MESSAGE(STATUS "Performing Test ${TEST} - Success") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${TEST} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") - ELSE("${result_var}" EQUAL 0) + else() MESSAGE(STATUS "Performing Test ${TEST} - Failed") SET(${VAR} "" CACHE INTERNAL "Test ${TEST}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log @@ -65,7 +69,7 @@ MACRO(CHECK_CXX_FILE_RUNS FILE VAR TEST) "${OUTPUT}\n" "Return value: ${result_var}\n" "Source file was:\n${SOURCE}\n") - ENDIF("${result_var}" EQUAL 0) - ENDIF("${VAR}" MATCHES "^${VAR}$") + endif() + endif() ENDMACRO(CHECK_CXX_FILE_RUNS) diff --git a/CMake/cmake/modules/FindBOOST_PROGRAM_OPTIONS.cmake b/CMake/cmake/modules/FindBOOST_PROGRAM_OPTIONS.cmake index 578d7fac9de..f352df55236 100644 --- a/CMake/cmake/modules/FindBOOST_PROGRAM_OPTIONS.cmake +++ b/CMake/cmake/modules/FindBOOST_PROGRAM_OPTIONS.cmake @@ -5,15 +5,19 @@ # TODO: support MacOSX # BOOST_PROGRAM_OPTIONS needs Boost -find_package(Boost QUIET) +find_package(Boost2 QUIET) if(Boost_FOUND AND Boost_LIBRARY_DIRS) if (BOOST_PROGRAM_OPTIONS_LIBRARIES) # Already in cache, be silent set(BOOST_PROGRAM_OPTIONS_FIND_QUIETLY TRUE) - endif (BOOST_PROGRAM_OPTIONS_LIBRARIES) + endif() - find_library(BOOST_PROGRAM_OPTIONS_LIBRARIES NAMES libboost_program_options - PATHS ${Boost_LIBRARY_DIRS}) + if ( AUTO_LINK_ENABLED ) + SET(BOOST_PROGRAM_OPTIONS_LIBRARIES ${Boost_LIBRARY_DIRS} ) + else() + find_library(BOOST_PROGRAM_OPTIONS_LIBRARIES NAMES libboost_program_options + PATHS ${Boost_LIBRARY_DIRS}) + endif() if(BOOST_PROGRAM_OPTIONS_LIBRARIES) set(BOOST_PROGRAM_OPTIONS_FOUND TRUE) @@ -21,17 +25,17 @@ if(Boost_FOUND AND Boost_LIBRARY_DIRS) # Print success/error message if(BOOST_PROGRAM_OPTIONS_FOUND) - if(NOT BOOST_PROGRAM_OPTIONS_FIND_QUIETLY) - message(STATUS "Found BOOST_PROGRAM_OPTIONS: ${BOOST_PROGRAM_OPTIONS_LIBRARIES}") - endif(NOT BOOST_PROGRAM_OPTIONS_FIND_QUIETLY) - else(BOOST_PROGRAM_OPTIONS_FOUND) - IF(BOOST_PROGRAM_OPTIONS_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could NOT find BOOST_PROGRAM_OPTIONS. Set the BOOST_PROGRAM_OPTIONS_LIBRARIES cmake cache entry.") - ELSE(BOOST_PROGRAM_OPTIONS_FIND_REQUIRED) - if(NOT BOOST_PROGRAM_OPTIONS_FIND_QUIETLY) - MESSAGE(STATUS "Could NOT find BOOST_PROGRAM_OPTIONS. Set the BOOST_PROGRAM_OPTIONS_LIBRARIES cmake cache entry.") - endif(NOT BOOST_PROGRAM_OPTIONS_FIND_QUIETLY) - ENDIF(BOOST_PROGRAM_OPTIONS_FIND_REQUIRED) + if(NOT BOOST_PROGRAM_OPTIONS_FIND_QUIETLY) + message(STATUS "Found BOOST_PROGRAM_OPTIONS: ${BOOST_PROGRAM_OPTIONS_LIBRARIES}") + endif(NOT BOOST_PROGRAM_OPTIONS_FIND_QUIETLY) + else(BOOST_PROGRAM_OPTIONS_FOUND) + IF(BOOST_PROGRAM_OPTIONS_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find BOOST_PROGRAM_OPTIONS. Set the BOOST_PROGRAM_OPTIONS_LIBRARIES cmake cache entry.") + ELSE(BOOST_PROGRAM_OPTIONS_FIND_REQUIRED) + if(NOT BOOST_PROGRAM_OPTIONS_FIND_QUIETLY) + MESSAGE(STATUS "Could NOT find BOOST_PROGRAM_OPTIONS. Set the BOOST_PROGRAM_OPTIONS_LIBRARIES cmake cache entry.") + endif(NOT BOOST_PROGRAM_OPTIONS_FIND_QUIETLY) + ENDIF(BOOST_PROGRAM_OPTIONS_FIND_REQUIRED) endif(BOOST_PROGRAM_OPTIONS_FOUND) mark_as_advanced(BOOST_PROGRAM_OPTIONS_LIBRARIES) diff --git a/CMake/cmake/modules/FindCGAL.cmake b/CMake/cmake/modules/FindCGAL.cmake index 7a9848acd3b..bff19f314f0 100644 --- a/CMake/cmake/modules/FindCGAL.cmake +++ b/CMake/cmake/modules/FindCGAL.cmake @@ -9,19 +9,26 @@ if (CGAL_INCLUDE_DIRS AND CGAL_LIBRARIES) set(CGAL_FIND_QUIETLY TRUE) endif (CGAL_INCLUDE_DIRS AND CGAL_LIBRARIES) -# TODO: search CGAL in ${CGAL_INSTALL_DIR} and ${CGAL_BINARY_DIR} -# -#find_path (CGAL_INCLUDE_DIRS NAMES CGAL/basic.h -# DOC "The directories containing include files for CGAL and third-party libraries") -# -#find_library(CGAL_LIBRARIES NAMES CGAL -# DOC "Path to CGAL and third-party libraries") +find_path (CGAL_ROOT NAMES include/CGAL/basic.h + PATHS ENV CGAL_ROOT ENV CGALROOT + DOC "The directories containing include files for CGAL and third-party libraries") -# TODO: include UseCGAL.cmake to define ${CGAL_DEFINITIONS}, ...? +if ( CGAL_ROOT ) + set( CGAL_INCLUDE_DIRS ${CGAL_ROOT}/include ) + + if ( AUTO_LINK_ENABLED ) + set(CGAL_LIBRARIES ${CGAL_ROOT}/lib ) + else() + find_library(CGAL_LIBRARIES NAMES CGAL + PATHS ${CGAL_ROOT}/lib + DOC "Path to CGAL and third-party libraries") + endif() -if(CGAL_INCLUDE_DIRS AND CGAL_LIBRARIES) - set(CGAL_FOUND TRUE) -endif(CGAL_INCLUDE_DIRS AND CGAL_LIBRARIES) + if(CGAL_INCLUDE_DIRS AND CGAL_LIBRARIES) + set(CGAL_FOUND TRUE) + endif() + +endif() # Print success/error message if(CGAL_FOUND) diff --git a/CMake/cmake/modules/FindCGAL_CORE.cmake b/CMake/cmake/modules/FindCGAL_CORE.cmake index 6cf190411d9..e4b83d90cd8 100644 --- a/CMake/cmake/modules/FindCGAL_CORE.cmake +++ b/CMake/cmake/modules/FindCGAL_CORE.cmake @@ -15,20 +15,24 @@ if(GMP_FOUND) # Find CORE include folder find_path(CGAL_CORE_INCLUDE_DIR NAMES CORE.h - PATHS ${CGAL_SOURCE_DIR}/include/CORE + PATHS ${CGAL_SOURCE_DIR}/include/CGAL/CORE DOC "The directory containing the CORE include files shipped with CGAL") - # We cannot search for the core++ library because it is not yet compiled - # => hard code the name - if (WIN32) - set(CGAL_CORE_LIBRARIES ${CGAL_BINARY_DIR}/lib/core++.lib) - else (WIN32) - if(BUILD_SHARED_LIBS) - set(CGAL_CORE_LIBRARIES ${CGAL_BINARY_DIR}/lib/libcore++.so) - else(BUILD_SHARED_LIBS) - set(CGAL_CORE_LIBRARIES ${CGAL_BINARY_DIR}/lib/libcore++.a) - endif(BUILD_SHARED_LIBS) - endif (WIN32) + if ( AUTO_LINK_ENABLED ) + SET(CGAL_CORE_LIBRARIES ${CGAL_BINARY_DIR}/lib ) + else() + # We cannot search for the core++ library because it is not yet compiled + # => hard code the name + if (WIN32) + set(CGAL_CORE_LIBRARIES ${CGAL_BINARY_DIR}/lib/core++.lib) + else (WIN32) + if(BUILD_SHARED_LIBS) + set(CGAL_CORE_LIBRARIES ${CGAL_BINARY_DIR}/lib/libcore++.so) + else(BUILD_SHARED_LIBS) + set(CGAL_CORE_LIBRARIES ${CGAL_BINARY_DIR}/lib/libcore++.a) + endif(BUILD_SHARED_LIBS) + endif (WIN32) + endif() if(CGAL_CORE_INCLUDE_DIR AND CGAL_CORE_LIBRARIES) set(CGAL_CORE_FOUND TRUE) @@ -36,17 +40,17 @@ if(GMP_FOUND) # Print success/error message if(CGAL_CORE_FOUND) - if(NOT CGAL_CORE_FIND_QUIETLY) - message(STATUS "Found CORE library shipped with CGAL: ${CGAL_CORE_LIBRARIES}") - endif(NOT CGAL_CORE_FIND_QUIETLY) - else(CGAL_CORE_FOUND) - IF(CGAL_CORE_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could NOT find CORE library shipped with CGAL. Set the CGAL_CORE_INCLUDE_DIR and CGAL_CORE_LIBRARIES cmake cache entries.") - ELSE(CGAL_CORE_FIND_REQUIRED) - if(NOT CGAL_CORE_FIND_QUIETLY) - MESSAGE(STATUS "Could NOT find CORE library shipped with CGAL. Set the CGAL_CORE_INCLUDE_DIR and CGAL_CORE_LIBRARIES cmake cache entries.") - endif(NOT CGAL_CORE_FIND_QUIETLY) - ENDIF(CGAL_CORE_FIND_REQUIRED) + if(NOT CGAL_CORE_FIND_QUIETLY) + message(STATUS "Found CORE library shipped with CGAL: ${CGAL_CORE_LIBRARIES}") + endif(NOT CGAL_CORE_FIND_QUIETLY) + else(CGAL_CORE_FOUND) + IF(CGAL_CORE_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find CORE library shipped with CGAL. Set the CGAL_CORE_INCLUDE_DIR and CGAL_CORE_LIBRARIES cmake cache entries.") + ELSE(CGAL_CORE_FIND_REQUIRED) + if(NOT CGAL_CORE_FIND_QUIETLY) + MESSAGE(STATUS "Could NOT find CORE library shipped with CGAL. Set the CGAL_CORE_INCLUDE_DIR and CGAL_CORE_LIBRARIES cmake cache entries.") + endif(NOT CGAL_CORE_FIND_QUIETLY) + ENDIF(CGAL_CORE_FIND_REQUIRED) endif(CGAL_CORE_FOUND) mark_as_advanced(CGAL_CORE_INCLUDE_DIR CGAL_CORE_LIBRARIES) diff --git a/CMake/cmake/modules/FindCORE.cmake b/CMake/cmake/modules/FindCORE.cmake index 1cba8060893..50af20fd573 100644 --- a/CMake/cmake/modules/FindCORE.cmake +++ b/CMake/cmake/modules/FindCORE.cmake @@ -25,17 +25,17 @@ if(GMP_FOUND) # Print success/error message if(CORE_FOUND) - if(NOT CORE_FIND_QUIETLY) - message(STATUS "Found CORE: ${CORE_LIBRARIES}") - endif(NOT CORE_FIND_QUIETLY) - else(CORE_FOUND) - IF(CORE_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could NOT find CORE. Set the CORE_INCLUDE_DIR and CORE_LIBRARIES cmake cache entries.") - ELSE(CORE_FIND_REQUIRED) - if(NOT CORE_FIND_QUIETLY) - MESSAGE(STATUS "Could NOT find CORE. Set the CORE_INCLUDE_DIR and CORE_LIBRARIES cmake cache entries.") - endif(NOT CORE_FIND_QUIETLY) - ENDIF(CORE_FIND_REQUIRED) + if(NOT CORE_FIND_QUIETLY) + message(STATUS "Found CORE: ${CORE_LIBRARIES}") + endif(NOT CORE_FIND_QUIETLY) + else(CORE_FOUND) + IF(CORE_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find CORE. Set the CORE_INCLUDE_DIR and CORE_LIBRARIES cmake cache entries.") + ELSE(CORE_FIND_REQUIRED) + if(NOT CORE_FIND_QUIETLY) + MESSAGE(STATUS "Could NOT find CORE. Set the CORE_INCLUDE_DIR and CORE_LIBRARIES cmake cache entries.") + endif(NOT CORE_FIND_QUIETLY) + ENDIF(CORE_FIND_REQUIRED) endif(CORE_FOUND) mark_as_advanced(CORE_INCLUDE_DIR CORE_LIBRARIES) diff --git a/CMake/cmake/modules/FindGMP.cmake b/CMake/cmake/modules/FindGMP.cmake index a67dafdcf31..77fccffa0f3 100644 --- a/CMake/cmake/modules/FindGMP.cmake +++ b/CMake/cmake/modules/FindGMP.cmake @@ -12,22 +12,28 @@ endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES) # After searching in standard places, # search for precompiled GMP included with CGAL on Windows -IF(WIN32) +if(WIN32) SET(GMP_INCLUDE_DIR_SEARCH ${CGAL_SOURCE_DIR}/auxiliary/gmp/include) SET(GMP_LIBRARIES_DIR_SEARCH ${CGAL_SOURCE_DIR}/auxiliary/gmp/lib) -ENDIF(WIN32) +endif(WIN32) find_path (GMP_INCLUDE_DIR NAMES gmp.h PATHS ${GMP_INCLUDE_DIR_SEARCH} DOC "The directory containing the GMP include files") -find_library(GMP_LIBRARIES NAMES gmp PATHS - ${GMP_LIBRARIES_DIR_SEARCH} - DOC "Path to the GMP library") +if ( AUTO_LINK_ENABLED ) + if ( EXISTS "${GMP_LIBRARIES_DIR_SEARCH}" ) + SET(GMP_LIBRARIES ${GMP_LIBRARIES_DIR_SEARCH} ) + endif() +else() + find_library(GMP_LIBRARIES NAMES gmp PATHS + ${GMP_LIBRARIES_DIR_SEARCH} + DOC "Path to the GMP library") +endif() if(GMP_INCLUDE_DIR AND GMP_LIBRARIES) set(GMP_FOUND TRUE) -endif(GMP_INCLUDE_DIR AND GMP_LIBRARIES) +endif() # Print success/error message if(GMP_FOUND) @@ -35,13 +41,13 @@ if(GMP_FOUND) message(STATUS "Found GMP: ${GMP_LIBRARIES}") endif(NOT GMP_FIND_QUIETLY) else(GMP_FOUND) - IF(GMP_FIND_REQUIRED) + if(GMP_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could NOT find GMP. Set the GMP_INCLUDE_DIR and GMP_LIBRARIES cmake cache entries.") - ELSE(GMP_FIND_REQUIRED) + else(GMP_FIND_REQUIRED) if(NOT GMP_FIND_QUIETLY) MESSAGE(STATUS "Could NOT find GMP. Set the GMP_INCLUDE_DIR and GMP_LIBRARIES cmake cache entries.") endif(NOT GMP_FIND_QUIETLY) - ENDIF(GMP_FIND_REQUIRED) + endif(GMP_FIND_REQUIRED) endif(GMP_FOUND) mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES) diff --git a/CMake/cmake/modules/FindGMPXX.cmake b/CMake/cmake/modules/FindGMPXX.cmake index 24479f5f20a..eea59420af4 100644 --- a/CMake/cmake/modules/FindGMPXX.cmake +++ b/CMake/cmake/modules/FindGMPXX.cmake @@ -14,10 +14,12 @@ if(GMP_FOUND) endif (GMPXX_INCLUDE_DIR AND GMPXX_LIBRARIES) find_path(GMPXX_INCLUDE_DIR NAMES gmpxx.h - DOC "The directory containing the GMPXX include files") + PATHS ${GMP_INCLUDE_DIR_SEARCH} + DOC "The directory containing the GMPXX include files") find_library(GMPXX_LIBRARIES NAMES gmpxx - DOC "Path to the GMPXX library") + PATHS ${GMP_LIBRARIES_DIR_SEARCH} + DOC "Path to the GMPXX library") if(GMPXX_INCLUDE_DIR AND GMPXX_LIBRARIES) set(GMPXX_FOUND TRUE) @@ -25,17 +27,17 @@ if(GMP_FOUND) # Print success/error message if(GMPXX_FOUND) - if(NOT GMPXX_FIND_QUIETLY) - message(STATUS "Found GMPXX: ${GMPXX_LIBRARIES}") - endif(NOT GMPXX_FIND_QUIETLY) - else(GMPXX_FOUND) - IF(GMPXX_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could NOT find GMPXX. Set the GMPXX_INCLUDE_DIR and GMPXX_LIBRARIES cmake cache entries.") - ELSE(GMPXX_FIND_REQUIRED) - if(NOT GMPXX_FIND_QUIETLY) - MESSAGE(STATUS "Could NOT find GMPXX. Set the GMPXX_INCLUDE_DIR and GMPXX_LIBRARIES cmake cache entries.") - endif(NOT GMPXX_FIND_QUIETLY) - ENDIF(GMPXX_FIND_REQUIRED) + if(NOT GMPXX_FIND_QUIETLY) + message(STATUS "Found GMPXX: ${GMPXX_LIBRARIES}") + endif(NOT GMPXX_FIND_QUIETLY) + else(GMPXX_FOUND) + IF(GMPXX_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find GMPXX. Set the GMPXX_INCLUDE_DIR and GMPXX_LIBRARIES cmake cache entries.") + ELSE(GMPXX_FIND_REQUIRED) + if(NOT GMPXX_FIND_QUIETLY) + MESSAGE(STATUS "Could NOT find GMPXX. Set the GMPXX_INCLUDE_DIR and GMPXX_LIBRARIES cmake cache entries.") + endif(NOT GMPXX_FIND_QUIETLY) + ENDIF(GMPXX_FIND_REQUIRED) endif(GMPXX_FOUND) mark_as_advanced(GMPXX_INCLUDE_DIR GMPXX_LIBRARIES) diff --git a/CMake/cmake/modules/FindMPFR.cmake b/CMake/cmake/modules/FindMPFR.cmake index 506679fb7bd..187005381ce 100644 --- a/CMake/cmake/modules/FindMPFR.cmake +++ b/CMake/cmake/modules/FindMPFR.cmake @@ -14,14 +14,20 @@ if(GMP_FOUND) endif (MPFR_INCLUDE_DIR AND MPFR_LIBRARIES) find_path(MPFR_INCLUDE_DIR NAMES mpfr.h - DOC "The directory containing the MPFR include files") + PATHS ${GMP_INCLUDE_DIR_SEARCH} + DOC "The directory containing the MPFR include files") - find_library(MPFR_LIBRARIES NAMES mpfr - DOC "Path to the MPFR library") + if ( AUTO_LINK_ENABLED ) + SET(MPFR_LIBRARIES ${GMP_LIBRARIES} ) + else() + find_library(MPFR_LIBRARIES NAMES mpfr + PATHS ${GMP_LIBRARIES_DIR_SEARCH} + DOC "Path to the MPFR library") + endif() - if(MPFR_INCLUDE_DIR AND MPFR_LIBRARIES) - set(MPFR_FOUND TRUE) - endif(MPFR_INCLUDE_DIR AND MPFR_LIBRARIES) + if( MPFR_INCLUDE_DIR AND MPFR_LIBRARIES) + set(MPFR_FOUND TRUE) + endif() # Print success/error message if(MPFR_FOUND) diff --git a/CMake/cmake/modules/FindTAUCS.cmake b/CMake/cmake/modules/FindTAUCS.cmake new file mode 100644 index 00000000000..61d971592f0 --- /dev/null +++ b/CMake/cmake/modules/FindTAUCS.cmake @@ -0,0 +1,53 @@ +# Try to find the TAUCS libraries +# TAUCS_FOUND - system has TAUCS lib +# TAUCS_INCLUDE_DIR - the TAUCS include directory +# TAUCS_LIBRARIES - Libraries needed to use TAUCS + +# TODO: support MacOSX + +if (TAUCS_INCLUDE_DIR AND TAUCS_LIBRARIES) + # Already in cache, be silent + set(TAUCS_FIND_QUIETLY TRUE) +endif (TAUCS_INCLUDE_DIR AND TAUCS_LIBRARIES) + +# After searching in standard places, +# search for precompiled TAUCS included with CGAL on Windows +if(WIN32) + SET(TAUCS_INCLUDE_DIR_SEARCH ${CGAL_SOURCE_DIR}/auxiliary/taucs/include) + SET(TAUCS_LIBRARIES_DIR_SEARCH ${CGAL_SOURCE_DIR}/auxiliary/taucs/lib) +endif(WIN32) + +find_path (TAUCS_INCLUDE_DIR NAMES taucs.h + PATHS ${TAUCS_INCLUDE_DIR_SEARCH} + DOC "The directory containing the TAUCS include files") + +if ( AUTO_LINK_ENABLED ) + if ( EXISTS "${TAUCS_LIBRARIES_DIR_SEARCH}" ) + SET(TAUCS_LIBRARIES ${TAUCS_LIBRARIES_DIR_SEARCH} ) + endif() +else() + find_library(TAUCS_LIBRARIES NAMES taucs PATHS + ${TAUCS_LIBRARIES_DIR_SEARCH} + DOC "Path to the TAUCS library") +endif() + +if(TAUCS_INCLUDE_DIR AND TAUCS_LIBRARIES) + set(TAUCS_FOUND TRUE) +endif() + +# Print success/error message +if(TAUCS_FOUND) + if(NOT TAUCS_FIND_QUIETLY) + message(STATUS "Found TAUCS: ${TAUCS_LIBRARIES}") + endif(NOT TAUCS_FIND_QUIETLY) +else(TAUCS_FOUND) + if(TAUCS_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find TAUCS. Set the TAUCS_INCLUDE_DIR and TAUCS_LIBRARIES cmake cache entries.") + else(TAUCS_FIND_REQUIRED) + if(NOT TAUCS_FIND_QUIETLY) + MESSAGE(STATUS "Could NOT find TAUCS. Set the TAUCS_INCLUDE_DIR and TAUCS_LIBRARIES cmake cache entries.") + endif(NOT TAUCS_FIND_QUIETLY) + endif(TAUCS_FIND_REQUIRED) +endif(TAUCS_FOUND) + +mark_as_advanced(TAUCS_INCLUDE_DIR TAUCS_LIBRARIES) diff --git a/CMake/cmake/modules/FindZLIB.cmake b/CMake/cmake/modules/FindZLIB.cmake index 1a2aefdcee8..3609151dd9f 100644 --- a/CMake/cmake/modules/FindZLIB.cmake +++ b/CMake/cmake/modules/FindZLIB.cmake @@ -16,18 +16,18 @@ ENDIF (ZLIB_INCLUDE_DIR) SET(ZLIB_INCLUDE_DIR_SEARCH /usr/local/include /usr/include) SET(ZLIB_LIBRARIES_DIR_SEARCH /usr/lib /usr/local/lib) IF(WIN32) - SET(ZLIB_INCLUDE_DIR_SEARCH ${CGAL_SOURCE_DIR}/auxiliary/zlib/include) - SET(ZLIB_LIBRARIES_DIR_SEARCH ${CGAL_SOURCE_DIR}/auxiliary/zlib/lib) + SET(ZLIB_INCLUDE_DIR_SEARCH ${ZLIB_INCLUDE_DIR_SEARCH} ${CGAL_SOURCE_DIR}/auxiliary/zlib/include) + SET(ZLIB_LIBRARIES_DIR_SEARCH ${ZLIB_LIBRARIES_DIR_SEARCH} ${CGAL_SOURCE_DIR}/auxiliary/zlib/lib) ENDIF(WIN32) -FIND_PATH (ZLIB_INCLUDE_DIR zlib.h PATHS - ${ZLIB_INCLUDE_DIR_SEARCH} +FIND_PATH (ZLIB_INCLUDE_DIR zlib.h + PATHS ${ZLIB_INCLUDE_DIR_SEARCH} DOC "The directory containing the ZLIB include files") SET(ZLIB_NAMES z zlib zdll) -FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} PATHS - ${ZLIB_LIBRARIES_DIR_SEARCH} - DOC "Path to the ZLIB library") +FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} + PATHS ${ZLIB_LIBRARIES_DIR_SEARCH} + DOC "Path to the ZLIB library") IF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) SET(ZLIB_FOUND TRUE)