Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
CoMISo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CoMISo
CoMISo
Commits
e90453c3
Commit
e90453c3
authored
Nov 26, 2018
by
Max Lyon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Simplify_CMakeList' into 'master'
Simplify c make list See merge request
!36
parents
6beba73a
03e7419c
Pipeline
#7886
passed with stages
in 8 minutes and 9 seconds
Changes
15
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
58 additions
and
1935 deletions
+58
-1935
CMakeLists.txt
CMakeLists.txt
+10
-22
cmake/ACGCommon.cmake
cmake/ACGCommon.cmake
+37
-0
cmake/CGAL_FindPackageHandleStandardArgs.cmake
cmake/CGAL_FindPackageHandleStandardArgs.cmake
+0
-55
cmake/CGAL_GeneratorSpecificSettings.cmake
cmake/CGAL_GeneratorSpecificSettings.cmake
+0
-56
cmake/CGAL_Locate_CGAL_TAUCS.cmake
cmake/CGAL_Locate_CGAL_TAUCS.cmake
+0
-120
cmake/CGAL_Macros.cmake
cmake/CGAL_Macros.cmake
+0
-378
cmake/FindBLAS.cmake
cmake/FindBLAS.cmake
+0
-516
cmake/FindCGAL.cmake
cmake/FindCGAL.cmake
+0
-166
cmake/FindGMM.cmake
cmake/FindGMM.cmake
+1
-0
cmake/FindGMP.cmake
cmake/FindGMP.cmake
+0
-64
cmake/FindIPOPT.cmake
cmake/FindIPOPT.cmake
+9
-8
cmake/FindLAPACK.cmake
cmake/FindLAPACK.cmake
+0
-374
cmake/FindMPFR.cmake
cmake/FindMPFR.cmake
+0
-85
cmake/FindSUITESPARSE.cmake
cmake/FindSUITESPARSE.cmake
+1
-0
cmake/FindTaucs.cmake
cmake/FindTaucs.cmake
+0
-91
No files found.
CMakeLists.txt
100755 → 100644
View file @
e90453c3
cmake_minimum_required
(
VERSION 2.6
)
#Only set project name if CoMISo is built as stand-alone library
if
(
"
${
PROJECT_NAME
}
"
STREQUAL
""
)
project
(
CoMISo
)
endif
()
# add our macro directory to cmake search path
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
set
(
CMAKE_DEBUG_POSTFIX
"d"
)
include
(
ACGCommon
)
# Flag to enable or disable QT widgets in CoMISo
set
(
WANT_COMISO_QT ON CACHE BOOL
"Enable Qt support in CoMISo"
)
if
(
WANT_COMISO_QT
)
acg_qt5
()
...
...
@@ -40,7 +36,7 @@ set(COMISO_LINK_DIRECTORIES "")
set
(
COMISO_LINK_LIBRARIES
""
)
set
(
NEED_LAPACK
""
)
FIND_PACKAGE
(
Boost 1.
42
.0 COMPONENTS system filesystem regex QUIET
)
FIND_PACKAGE
(
Boost 1.
59
.0 COMPONENTS system filesystem regex QUIET
)
if
(
Boost_FOUND
)
set
(
COMISO_BOOST_CONFIG_FILE_SETTINGS
"#define COMISO_BOOST_AVAILABLE 1"
)
list
(
APPEND COMISO_INCLUDE_DIRECTORIES
${
Boost_INCLUDE_DIRS
}
)
...
...
@@ -73,20 +69,8 @@ else()
message
(
FATAL_ERROR
"GMM not found!"
)
endif
()
# We require cgal with its blas on windows
find_package
(
CGAL
)
if
(
CGAL_FOUND
)
set
(
COMISO_CGAL_CONFIG_FILE_SETTINGS
"#define COMISO_CGAL_AVAILABLE 1"
)
list
(
APPEND COMISO_INCLUDE_DIRECTORIES
${
CGAL_INCLUDE_DIR
}
)
list
(
APPEND COMISO_LINK_DIRECTORIES
${
CGAL_LIBRARY_DIR
}
)
list
(
APPEND COMISO_LINK_LIBRARIES
${
CGAL_LIBRARIES
}
)
add_definitions
(
-DCGAL_NO_AUTOLINK
)
else
()
set
(
COMISO_CGAL_CONFIG_FILE_SETTINGS
"#define COMISO_CGAL_AVAILABLE 0"
)
message
(
STATUS
"CGAL not found!"
)
endif
()
set
(
TMP_CMAKE_FIND_LIBRARY_PREFIXES
"
${
CMAKE_FIND_LIBRARY_PREFIXES
}
"
)
set
(
CMAKE_FIND_LIBRARY_PREFIXES lib
""
)
#Our blas librariy is called libblas.lib. Is there a better way to find it than this?
find_package
(
BLAS
)
if
(
BLAS_FOUND
)
set
(
COMISO_BLAS_CONFIG_FILE_SETTINGS
"#define COMISO_BLAS_AVAILABLE 1"
)
...
...
@@ -98,6 +82,7 @@ else()
set
(
COMISO_BLAS_CONFIG_FILE_SETTINGS
"#define COMISO_BLAS_AVAILABLE 0"
)
message
(
STATUS
"BLAS not found!"
)
endif
()
set
(
CMAKE_FIND_LIBRARY_PREFIXES
"
${
TMP_CMAKE_FIND_LIBRARY_PREFIXES
}
"
)
find_package
(
ADOLC
)
if
(
ADOLC_FOUND
)
...
...
@@ -288,7 +273,7 @@ endif ()
find_package
(
Taucs
)
set
(
SUPRESS_TAUCS OFF CACHE BOOL
"Set to ON if CoMISo should be built without TAUCS."
)
if
(
TAUCS_FOUND AND NOT SUPRESS_TAUCS
)
list
(
APPEND NEED_LAPACK
"Ta
cu
s"
)
list
(
APPEND NEED_LAPACK
"Ta
uc
s"
)
set
(
COMISO_TAUCS_CONFIG_FILE_SETTINGS
"#define COMISO_TAUCS_AVAILABLE 1"
)
list
(
APPEND COMISO_INCLUDE_DIRECTORIES
${
TAUCS_INCLUDE_DIR
}
)
list
(
APPEND COMISO_LINK_LIBRARIES
${
TAUCS_LIBRARY
}
)
...
...
@@ -345,7 +330,9 @@ else ()
set
(
COMISO_CPLEX_CONFIG_FILE_SETTINGS
"#define COMISO_CPLEX_AVAILABLE 0"
)
endif
()
if
(
NEED_LAPACK
)
set
(
TMP_CMAKE_FIND_LIBRARY_PREFIXES
"
${
CMAKE_FIND_LIBRARY_PREFIXES
}
"
)
set
(
CMAKE_FIND_LIBRARY_PREFIXES lib
""
)
#Our lapack library is called liblapack.lib. Is there a better way to find it than this?
if
(
NEED_LAPACK AND NOT SUITESPARSE_FOUND
)
FIND_PACKAGE
(
LAPACK
)
if
(
LAPACK_FOUND
)
list
(
APPEND COMISO_INCLUDE_DIRECTORIES
${
LAPACK_INCLUDE_DIR
}
)
...
...
@@ -354,7 +341,8 @@ if (NEED_LAPACK)
else
()
message
(
STATUS
"LAPACK not found!"
)
endif
()
endif
(
NEED_LAPACK
)
endif
(
NEED_LAPACK AND NOT SUITESPARSE_FOUND
)
set
(
CMAKE_FIND_LIBRARY_PREFIXES
"
${
TMP_CMAKE_FIND_LIBRARY_PREFIXES
}
"
)
include_directories
(
..
...
...
cmake/ACGCommon.cmake
View file @
e90453c3
...
...
@@ -982,3 +982,40 @@ function (generate_qhp_file files_loc plugin_name)
endif
()
endforeach
()
endfunction
()
# Set path to libraries VS_SEARCH_PATH
if
(
WIN32
)
if
(
CMAKE_GENERATOR MATCHES
".*Win64"
)
SET
(
DIRSUFFIX
"lib64"
)
else
()
SET
(
DIRSUFFIX
"lib"
)
endif
()
# Check if the base path is set
if
(
NOT CMAKE_WINDOWS_LIBS_DIR
)
# This is the base directory for windows library search used in the finders we shipp.
set
(
CMAKE_WINDOWS_LIBS_DIR
"c:/libs"
CACHE STRING
"Default Library search dir on windows."
)
endif
()
if
(
CMAKE_GENERATOR MATCHES
"^Visual Studio 11.*Win64"
)
SET
(
VS_SEARCH_PATH
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/vs2012/x64/"
)
elseif
(
CMAKE_GENERATOR MATCHES
"^Visual Studio 11.*"
)
SET
(
VS_SEARCH_PATH
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/vs2012/x32/"
)
elseif
(
CMAKE_GENERATOR MATCHES
"^Visual Studio 12.*Win64"
)
SET
(
VS_SEARCH_PATH
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/vs2013/x64/"
)
elseif
(
CMAKE_GENERATOR MATCHES
"^Visual Studio 12.*"
)
SET
(
VS_SEARCH_PATH
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/vs2013/x32/"
)
elseif
(
CMAKE_GENERATOR MATCHES
"^Visual Studio 14.*Win64"
)
SET
(
VS_SEARCH_PATH
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/vs2015/x64/"
)
elseif
(
CMAKE_GENERATOR MATCHES
"^Visual Studio 14.*"
)
SET
(
VS_SEARCH_PATH
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/vs2015/x32/"
)
elseif
(
CMAKE_GENERATOR MATCHES
"^Visual Studio 15.*Win64"
)
SET
(
VS_SEARCH_PATH
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/vs2017/x64/"
)
elseif
(
CMAKE_GENERATOR MATCHES
"^Visual Studio 15.*"
)
SET
(
VS_SEARCH_PATH
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/vs2017/x32/"
)
endif
()
set
(
CMAKE_PREFIX_PATH
${
CMAKE_PREFIX_PATH
}
"
${
VS_SEARCH_PATH
}
"
"
${
VS_SEARCH_PATH
}
/lapack_blas_windows"
)
endif
(
WIN32
)
cmake/CGAL_FindPackageHandleStandardArgs.cmake
deleted
100644 → 0
View file @
6beba73a
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
# This macro is intended to be used in FindXXX.cmake modules files.
# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
# it also sets the <UPPERCASED_NAME>_FOUND variable.
# The package is found if all variables listed are TRUE.
# Example:
#
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
#
# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and
# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
# independent whether QUIET was used or not.
# If it is found, the location is reported using the VAR1 argument, so
# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
# If the second argument is DEFAULT_MSG, the message in the failure case will
# be "Could NOT find LibXml2", if you don't like this message you can specify
# your own custom failure message there.
macro
(
FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1
)
if
(
"
${
_FAIL_MSG
}
"
STREQUAL
"DEFAULT_MSG"
)
set
(
_FAIL_MESSAGE
"Could NOT find
${
_NAME
}
"
)
else
()
set
(
_FAIL_MESSAGE
"
${
_FAIL_MSG
}
"
)
endif
()
string
(
TOUPPER
${
_NAME
}
_NAME_UPPER
)
set
(
${
_NAME_UPPER
}
_FOUND TRUE
)
if
(
NOT
${
_VAR1
}
)
set
(
${
_NAME_UPPER
}
_FOUND FALSE
)
endif
()
foreach
(
_CURRENT_VAR
${
ARGN
}
)
if
(
NOT
${
_CURRENT_VAR
}
)
set
(
${
_NAME_UPPER
}
_FOUND FALSE
)
endif
()
endforeach
()
if
(
${
_NAME_UPPER
}
_FOUND
)
if
(
NOT
${
_NAME
}
_FIND_QUIETLY
)
message
(
STATUS
"Found
${
_NAME
}
:
${${
_VAR1
}}
"
)
endif
()
else
()
if
(
${
_NAME
}
_FIND_REQUIRED
)
message
(
FATAL_ERROR
"
${
_FAIL_MESSAGE
}
"
)
else
()
if
(
NOT
${
_NAME
}
_FIND_QUIETLY
)
message
(
STATUS
"
${
_FAIL_MESSAGE
}
"
)
endif
()
endif
()
endif
()
endmacro
()
cmake/CGAL_GeneratorSpecificSettings.cmake
deleted
100755 → 0
View file @
6beba73a
if
(
NOT CGAL_GENERATOR_SPECIFIC_SETTINGS_FILE_INCLUDED
)
set
(
CGAL_GENERATOR_SPECIFIC_SETTINGS_FILE_INCLUDED 1
)
message
(
STATUS
"Targetting
${
CMAKE_GENERATOR
}
"
)
if
(
MSVC
)
message
(
STATUS
"Target build enviroment supports auto-linking"
)
set
(
CGAL_AUTO_LINK_ENABLED TRUE
)
endif
()
if
(
MSVC15
)
set
(
CGAL_TOOLSET
"vc150"
)
message
(
STATUS
"Using VC15 compiler."
)
elseif
(
MSVC14
)
set
(
CGAL_TOOLSET
"vc140"
)
message
(
STATUS
"Using VC14 compiler."
)
elseif
(
MSVC12
)
set
(
CGAL_TOOLSET
"vc120"
)
message
(
STATUS
"Using VC12 compiler."
)
elseif
(
MSVC11
)
set
(
CGAL_TOOLSET
"vc110"
)
message
(
STATUS
"Using VC11 compiler."
)
elseif
(
MSVC10
)
set
(
CGAL_TOOLSET
"vc100"
)
message
(
STATUS
"Using VC10 compiler."
)
elseif
(
MSVC90
)
set
(
CGAL_TOOLSET
"vc90"
)
message
(
STATUS
"Using VC90 compiler."
)
elseif
(
MSVC80
)
set
(
CGAL_TOOLSET
"vc80"
)
message
(
STATUS
"Using VC80 compiler."
)
elseif
(
MSVC71
)
set
(
CGAL_TOOLSET
"vc71"
)
message
(
STATUS
"Using VC71 compiler."
)
else
()
message
(
STATUS
"Using
${
CMAKE_CXX_COMPILER
}
compiler."
)
endif
()
# From james Bigler, in the cmake users list.
IF
(
APPLE
)
exec_program
(
uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION
)
string
(
REGEX MATCH
"[0-9]+"
DARWIN_VERSION
${
DARWIN_VERSION
}
)
message
(
STATUS
"DARWIN_VERSION=
${
DARWIN_VERSION
}
"
)
if
(
DARWIN_VERSION GREATER 8
)
message
(
STATUS
"Mac Leopard detected"
)
set
(
CGAL_APPLE_LEOPARD 1
)
endif
()
endif
()
if
(
NOT
"
${
CMAKE_CFG_INTDIR
}
"
STREQUAL
"."
)
set
(
HAS_CFG_INTDIR TRUE CACHE INTERNAL
"Generator uses intermediate configuration directory"
)
message
(
STATUS
"Generator uses intermediate configuration directory:
${
CMAKE_CFG_INTDIR
}
"
)
endif
()
endif
()
cmake/CGAL_Locate_CGAL_TAUCS.cmake
deleted
100755 → 0
View file @
6beba73a
# Find TAUCS library shipped with CGAL
#
# This module searches for TAUCS in CGAL "auxiliary" folder
# and in in $CGAL_TAUCS_DIR environment variable.
#
# This module sets the following variables:
# CGAL_TAUCS_FOUND - set to true if TAUCS library shipped with CGAL
# is found
# CGAL_TAUCS_PLATFORM - name of TAUCS subfolder corresponding to the current compiler
# CGAL_TAUCS_INCLUDE_DIR - list of folders (using full path name) containing
# TAUCS (and optionaly BLAS and LAPACK) headers
# CGAL_TAUCS_LIBRARIES_DIR -list of folders (using full path name) containing
# TAUCS (and optionaly BLAS and LAPACK) libraries
include
(
CGAL_Macros
)
if
(
NOT CGAL_TAUCS_FOUND
)
#
# Find out TAUCS name for the current platform.
# This code is a translation of TAUCS "configure" script.
#
# The first task is to figure out CMAKE_SYSTEM_NAME
# (on unix this is uname -s, for windows it is Windows).
#message("DEBUG: CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
#message("DEBUG: CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
set
(
CGAL_TAUCS_PLATFORM
"
${
CMAKE_SYSTEM_NAME
}
"
)
# Convert to lower case
STRING
(
TOLOWER
"
${
CGAL_TAUCS_PLATFORM
}
"
CGAL_TAUCS_PLATFORM
)
# Sometimes uname returns a value that is
# inconsistent with the way CGAL_TAUCS_PLATFORM is set. For example, on
# Solaris, CGAL_TAUCS_PLATFORM=solaris but uname returns SunOS.
if
(
${
CGAL_TAUCS_PLATFORM
}
STREQUAL
"sunos"
)
set
(
CGAL_TAUCS_PLATFORM
"solaris"
)
endif
()
if
(
${
CGAL_TAUCS_PLATFORM
}
STREQUAL
"windows"
)
set
(
CGAL_TAUCS_PLATFORM
"win32"
)
endif
()
# LS 2007: added "darwin_intel" for Intel Macs.
# "darwin" = original Darwin platform = PowerPC architecture.
if
(
${
CGAL_TAUCS_PLATFORM
}
STREQUAL
"darwin"
)
# CMAKE_SYSTEM_PROCESSOR=uname -p
if
(
${
CMAKE_SYSTEM_PROCESSOR
}
STREQUAL
"i386"
)
set
(
CGAL_TAUCS_PLATFORM
"darwin_intel"
)
endif
()
endif
()
# LS 2007: append "64" if 64 bits processor (tested on Linux only)
if
(
${
CGAL_TAUCS_PLATFORM
}
STREQUAL
"linux"
)
# CMAKE_SYSTEM_PROCESSOR=uname -p
if
(
${
CMAKE_SYSTEM_PROCESSOR
}
MATCHES
".*64.*"
)
set
(
CGAL_TAUCS_PLATFORM
"
${
CGAL_TAUCS_PLATFORM
}
64"
)
endif
()
endif
()
#message("DEBUG: CGAL_TAUCS_PLATFORM = ${CGAL_TAUCS_PLATFORM}")
#
# Search for TAUCS folder.
#
#message("DEBUG: CGAL_SOURCE_DIRECTORY = ${CGAL_SOURCE_DIRECTORY}")
# VC++ uses auto-link, thus we search for a folder containing the output of
# build_taucs_win32_for_CGAL.bat/build_taucs_win64_for_CGAL.bat,
# ie TAUCS libraries compiled for all Windows runtimes.
if
(
MSVC
)
# Check $CGAL_TAUCS_DIR environment variable
fetch_env_var
(
CGAL_TAUCS_DIR
)
#message("DEBUG: CGAL_TAUCS_DIR = ${CGAL_TAUCS_DIR}")
if
(
NOT
"
${
CGAL_TAUCS_DIR
}
"
STREQUAL
""
AND EXISTS
${
CGAL_TAUCS_DIR
}
)
set
(
CGAL_TAUCS_INCLUDE_DIR
"
${
CGAL_TAUCS_DIR
}
/include"
)
set
(
CGAL_TAUCS_LIBRARIES_DIR
"
${
CGAL_TAUCS_DIR
}
/lib"
)
set
(
CGAL_TAUCS_FOUND TRUE
)
# Else, search for TAUCS in CGAL "auxiliary" folder
elseif
(
EXISTS
"
${
CGAL_SOURCE_DIRECTORY
}
/auxiliary/taucs"
)
set
(
CGAL_TAUCS_INCLUDE_DIR
"
${
CGAL_SOURCE_DIRECTORY
}
/auxiliary/taucs/include"
)
set
(
CGAL_TAUCS_LIBRARIES_DIR
"
${
CGAL_SOURCE_DIRECTORY
}
/auxiliary/taucs/lib"
)
set
(
CGAL_TAUCS_FOUND TRUE
)
endif
()
# On Unix, search for TAUCS "taucs_full" folder
else
(
MSVC
)
# Check $CGAL_TAUCS_DIR environment variable
fetch_env_var
(
CGAL_TAUCS_DIR
)
#message("DEBUG: CGAL_TAUCS_DIR = ${CGAL_TAUCS_DIR}")
if
(
NOT
"
${
CGAL_TAUCS_DIR
}
"
STREQUAL
""
AND EXISTS
${
CGAL_TAUCS_DIR
}
)
set
(
CGAL_TAUCS_INCLUDE_DIR
"
${
CGAL_TAUCS_DIR
}
/build/
${
CGAL_TAUCS_PLATFORM
}
"
"
${
CGAL_TAUCS_DIR
}
/src"
)
set
(
CGAL_TAUCS_LIBRARIES_DIR
"
${
CGAL_TAUCS_DIR
}
/external/lib/
${
CGAL_TAUCS_PLATFORM
}
"
"
${
CGAL_TAUCS_DIR
}
/lib/
${
CGAL_TAUCS_PLATFORM
}
"
)
set
(
CGAL_TAUCS_FOUND TRUE
)
endif
()
endif
(
MSVC
)
# Add variables to cache
set
(
CGAL_TAUCS_DIR
"
${
CGAL_TAUCS_DIR
}
"
CACHE PATH
"Directory containing BLAS, LAPACK and TAUCS"
)
#message("DEBUG: CGAL_TAUCS_INCLUDE_DIR = ${CGAL_TAUCS_INCLUDE_DIR}")
#message("DEBUG: CGAL_TAUCS_LIBRARIES_DIR = ${CGAL_TAUCS_LIBRARIES_DIR}")
#message("DEBUG: CGAL_TAUCS_FOUND = ${CGAL_TAUCS_FOUND}")
endif
(
NOT CGAL_TAUCS_FOUND
)
cmake/CGAL_Macros.cmake
deleted
100755 → 0
View file @
6beba73a
if
(
NOT CGAL_MACROS_FILE_INCLUDED
)
set
(
CGAL_MACROS_FILE_INCLUDED 1
)
macro
(
assert _arg
)
if
(
NOT
${
_arg
}
)
message
(
FATAL_ERROR
"Variable
${
_arg
}
must be defined"
)
endif
()
endmacro
()
macro
(
hide_variable var
)
set
(
${
var
}
${${
var
}}
CACHE INTERNAL
"Variable hidden from user"
FORCE
)
endmacro
()
macro
(
cache_set var
)
set
(
${
var
}
${
ARGN
}
CACHE INTERNAL
""
)
set
(
${
var
}
${
ARGN
}
CACHE INTERNAL
""
)
endmacro
()
macro
(
typed_cache_set type doc var
)
set
(
${
var
}
${
ARGN
}
CACHE
${
type
}
${
doc
}
FORCE
)
set
(
${
var
}
${
ARGN
}
CACHE
${
type
}
${
doc
}
FORCE
)
endmacro
()
macro
(
cache_get var
)
set
(
${
var
}
)
endmacro
()
# Splits inlist in the first element (head) and the rest (tail)
macro
(
list_split head tail
)
set
(
${
head
}
)
set
(
${
tail
}
)
set
(
_LS_is_head TRUE
)
foreach
(
_LS_item
${
ARGN
}
)
if
(
_LS_is_head
)
set
(
${
head
}
${
_LS_item
}
)
set
(
_LS_is_head FALSE
)
else
()
list
(
APPEND
${
tail
}
${
_LS_item
}
)
endif
()
endforeach
()
endmacro
()
# adds elements to an internal cached list
macro
(
add_to_cached_list listname
)
cache_get
(
${
listname
}
)
set
(
_ATC_
${
listname
}
_tmp
${${
listname
}}
)
if
(
NOT
"
${
ARGN
}
"
STREQUAL
""
)
list
(
APPEND _ATC_
${
listname
}
_tmp
${
ARGN
}
)
endif
()
cache_set
(
${
listname
}
${
_ATC_
${
listname
}
_tmp
}
)
endmacro
()
# adds elements to an in-memory variable named 'listname'
macro
(
add_to_memory_list listname
)
if
(
NOT
"
${
ARGN
}
"
STREQUAL
""
)
list
(
APPEND
${
listname
}
${
ARGN
}
)
endif
()
endmacro
()
# adds elements to a list.
# If the first argument after 'listname' is PERSISTENT then 'listname'
# is a persistent internal cached variable, otherwise is a memory variable.
macro
(
add_to_list listname
)
list_split
(
_ATL_ARGN_HEAD _ATL_ARGN_TAIL
${
ARGN
}
)
if
(
"
${
_ATL_ARGN_HEAD
}
"
STREQUAL
"PERSISTENT"
)
add_to_cached_list
(
${
listname
}
${
_ATL_ARGN_TAIL
}
)
else
()
add_to_memory_list
(
${
listname
}
${
ARGN
}
)
endif
()
endmacro
()
macro
(
at list idx var
)
list
(
LENGTH
${
list
}
${
list
}
_length
)
if
(
${
idx
}
LESS
${${
list
}
_length
}
)
list
(
GET
${
list
}
${
idx
}
${
var
}
)
else
()
set
(
${
var
}
"NOTFOUND"
)
endif
()
endmacro
()
macro
(
found_in_list item_list item result
)
set
(
${
result
}
"FALSE"
)
foreach
(
element
${${
item_list
}}
)
if
(
"
${
element
}
"
STREQUAL
"
${
item
}
"
)
set
(
${
result
}
"TRUE"
)
endif
()
endforeach
()
endmacro
()
macro
(
uniquely_add_flags target_var
)
if
(
"
${
ARGC
}
"
GREATER
"1"
)
set
(
target_list
"
${${
target_var
}}
"
)
set
(
source_list
"
${
ARGN
}
"
)
separate_arguments
(
target_list
)
separate_arguments
(
source_list
)
foreach
(
flag
${
source_list
}
)
found_in_list
(
target_list
${
flag
}
${
flag
}
_FOUND
)
if
(
NOT
${
flag
}
_FOUND
)
typed_cache_set
(
STRING
"User-defined flags"
${
target_var
}
"
${${
target_var
}}
${
flag
}
"
)
endif
()
endforeach
()
endif
()
endmacro
()
macro
(
get_dependency_version LIB
)
if
(
"
${
ARGC
}
"
GREATER
"1"
)
set
(
PKG
${
ARGV1
}
)
else
()
set
(
PKG
${
LIB
}
)
endif
()
if
(
${
PKG
}
_FOUND
)
set
(
${
LIB
}
_VERSION
"unknown"
)
try_run
(
${
LIB
}
_RUN_RES
${
LIB
}
_COMPILE_RES
"
${
CMAKE_BINARY_DIR
}
"
"
${
CMAKE_SOURCE_DIR
}
/config/support/print_
${
LIB
}
_version.cpp"
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=
${${
PKG
}
_DEPENDENCY_INCLUDE_DIR
}
;
${${
PKG
}
_INCLUDE_DIR
}
"
"-DLINK_LIBRARIES:STRING=
${${
PKG
}
_DEPENDENCY_LIBRARIES
}
;
${${
PKG
}
_LIBRARIES
}
"
"-DLINK_DIRECTORIES:STRING=
${${
PKG
}
_DEPENDENCY_LIBRARY_DIR
}
;
${${
PKG
}
_LIBRARY_DIR
}
"
OUTPUT_VARIABLE
${
LIB
}
_OUTPUT
)
if
(
${
LIB
}
_COMPILE_RES
)
if
(
${
LIB
}
_RUN_RES EQUAL
"0"
)
string
(
REGEX MATCH
"version=.*
\$
"
${
LIB
}
_VERSION_LINE
${${
LIB
}
_OUTPUT
}
)
string
(
REPLACE
"
\n
"
""
${
LIB
}
_VERSION_LINE2
${${
LIB
}
_VERSION_LINE
}
)
string
(
REPLACE
"
\r
"
""
${
LIB
}
_VERSION_LINE3
${${
LIB
}
_VERSION_LINE2
}
)
string
(
REPLACE
"version="
""
${
LIB
}
_VERSION
${${
LIB
}
_VERSION_LINE3
}
)
else
()
message
(
STATUS
"WARNING:
${
LIB
}
found but print_
${
LIB
}
_version.cpp exited with error condition:
${${
LIB
}
_RUN_RES
}
"
)
message
(
STATUS
"
${
PKG
}
_INCLUDE_DIR=
${${
PKG
}
_INCLUDE_DIR
}
"
)
message
(
STATUS
"
${
PKG
}
_LIBRARIES=
${${
PKG
}
_LIBRARIES
}
"
)
message
(
STATUS
"
${
PKG
}
_LIBRARY_DIR=
${${
PKG
}
_LIBRARY_DIR
}
"
)
message
(
STATUS
"
${${
LIB
}
_OUTPUT
}
"
)
endif
()
else
()
message
(
STATUS
"WARNING:
${
LIB
}
found but could not compile print_
${
LIB
}
_version.cpp:"
)
message
(
STATUS
"
${
PKG
}
_INCLUDE_DIR=
${${
PKG
}
_INCLUDE_DIR
}
"
)
message
(
STATUS
"
${
PKG
}
_LIBRARIES=
${${
PKG
}
_LIBRARIES
}
"
)
message
(
STATUS
"
${
PKG
}
_LIBRARY_DIR=
${${
PKG
}
_LIBRARY_DIR
}
"
)
message
(
STATUS
"
${${
LIB
}
_OUTPUT
}
"
)
endif
()
message
(
STATUS
"USING
${
LIB
}
_VERSION = '
${${
LIB
}
_VERSION
}
'"
)
endif
()
endmacro
()
macro
(
create_CGALconfig_files
)
# FindCGAL and UseCGAL are platform specific so they are generated and stored in the binary folder.
configure_file
(
${
CGAL_MODULES_DIR
}
/CGALConfig_binary.cmake.in
${
CMAKE_BINARY_DIR
}
/CGALConfig.cmake @ONLY IMMEDIATE
)
if
(
SOURCE_INSTALL
)
configure_file
(
${
CGAL_MODULES_DIR
}
/CGALConfig_install.cmake.source.in
${
CMAKE_BINARY_DIR
}
/config/CGALConfig.cmake @ONLY IMMEDIATE
)
else
()
configure_file
(
${
CGAL_MODULES_DIR
}
/CGALConfig_install.cmake.fhs.in
${
CMAKE_BINARY_DIR
}
/config/CGALConfig.cmake @ONLY IMMEDIATE
)
endif
()
endmacro
()
macro
(
fetch_env_var VAR
)
if
(
"
${${
VAR
}}
"
STREQUAL
""
)
set
(
${
VAR
}
_env_value
"$ENV{
${
VAR
}
}"
)
if
(
NOT
"
${${
VAR
}
_env_value
}
"
STREQUAL
""
)
set
(
${
VAR
}
${${
VAR
}
_env_value
}
)
endif
()
endif
()
endmacro
()
# Composes a tagged list of libraries: a list with interpersed keywords or tags
# indicating that all following libraries, up to the next tag, are to be linked only for the
# corresponding build type. The 'general' tag indicates libraries that corresponds to all build types.
# 'optimized' corresponds to release builds and 'debug' to debug builds. Tags are case sensitve and
# the inital range of libraries listed before any tag is implicitely 'general'
#
# This macro takes 3 lists of general, optimized and debug libraries, resp, and populates the list
# given in the fourth argument.
#
# The first three parameters must be strings containing a semi-colon separated list of elements.
# All three lists must be passed, but any of them can be an empty string "".
# The fourth parameter, corresponding to the result, must be a variable name and it will be APPENDED
# (retaining any previous contents)
#
# If there is a last parameter whose value is "PERSISTENT" then the result is an internal cached variable,
# otherwise it is an in-memory variable
#
macro
(
compose_tagged_libraries libs_general libs_optimized libs_debug libs
)
if
(
"
${
ARGN
}
"
STREQUAL
"PERSISTENT"
)
set
(
_CTL_IN_CACHE
"PERSISTENT"
)
else
()
set
(
_CTL_IN_CACHE
)
endif
()
if
(
NOT
"
${
libs_general
}
"
STREQUAL
""
)
add_to_list
(
${
libs
}
${
_CTL_IN_CACHE
}
${
libs_general
}
)
endif
()
if
(
NOT
"
${
libs_optimized
}
"
STREQUAL
""
)
add_to_list
(
${
libs
}
${
_CTL_IN_CACHE
}
optimized
${
libs_optimized
}
)
endif
()
if
(
NOT
"
${
libs_debug
}
"
STREQUAL
""
)
add_to_list
(
${
libs
}
${
_CTL_IN_CACHE
}
debug
${
libs_debug
}
)
endif
()
endmacro
()
# Decomposes a tagged list of libraries (see macro compose_tagged_libraries).
# The first argument is the tagged list and the next 3 arguments are the lists
# where the general, optimized and debug libraries are collected.
#
# The first parameter must be a string containing a semi-colon separated list of elements.
# It cannot be ommitted, but it can be an empty string ""
#
# TThe next three arguments must be the names of the variables containing the result, and they
# will be APPENDED (retaining any previous contents)
#
# If there is a last parameter whose value is "PERSISTENT" then the result variables are internal in the cache,
# otherwise they are in-memory.
#
macro
(
decompose_tagged_libraries libs libs_general libs_optimized libs_debug
)
if
(
"
${
ARGN
}
"
STREQUAL
"PERSISTENT"
)
set
(
_DTL_IN_CACHE
"PERSISTENT"
)
else
()
set
(
_DTL_IN_CACHE
)
endif
()
set
(
_DTL_tag general
)
foreach
(
_DTL_lib
${
libs
}
)
if
(
"
${
_DTL_lib
}
"
STREQUAL
"general"
OR
"
${
_DTL_lib
}
"
STREQUAL
"optimized"
OR
"
${
_DTL_lib
}
"
STREQUAL
"debug"
)
set
(
_DTL_tag
"
${
_DTL_lib
}
"
)
else
()
if
(
"
${
_DTL_tag
}
"
STREQUAL
"general"
)
set
(
_DTL_target
${
libs_general
}
)
elseif
(
"
${
_DTL_tag
}
"
STREQUAL
"optimized"
)
set
(
_DTL_target
${
libs_optimized
}
)
else
()
set
(
_DTL_target
${
libs_debug
}
)
endif
()
add_to_list
(
${
_DTL_target
}
${
_DTL_IN_CACHE
}
${
_DTL_lib
}
)
endif
()
endforeach
()
endmacro
()
# Given lists of optimized and debug libraries, creates a tagged list which will
# contain the libraries listed in the 'general' section if any of the two lists is empty,
#
# All arguments are variable names (not values), thus the input list can be undefined or empty.