-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
84 lines (69 loc) · 3.17 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.16...3.21)
project(geant4cgalboolean VERSION 1.0.0)
#----------------------------------------------------------------------------
# Find Geant4 package, activating all available Vis drivers by default
# You can set WITH_GEANT4_VIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_VIS "Build example with Geant4 Vis drivers" ON)
if(WITH_GEANT4_VIS)
find_package(Geant4 REQUIRED gdml vis_all)
else()
find_package(Geant4 REQUIRED gdml)
endif()
#----------------------------------------------------------------------------
# Add external 3rd party libraries
#
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
#
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile definitions
find_package(CGAL 5 REQUIRED)
find_package(Catch2 REQUIRED)
find_package(Eigen3 REQUIRED NO_MODULE)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR})
file(GLOB CGALLibSources ${PROJECT_SOURCE_DIR}/src/*cc)
file(GLOB CGALLibHeaders ${PROJECT_SOURCE_DIR}/include/*.hh)
add_library(g4cgalboolean SHARED ${CGALLibSources} ${CGALLibHeaders})
target_compile_options(g4cgalboolean PRIVATE -Werror )
target_link_libraries(g4cgalboolean ${Geant4_LIBRARIES} CGAL::CGAL Eigen3::Eigen)
file(GLOB TestSources ${PROJECT_SOURCE_DIR}/test/*cc)
file(GLOB TestHeaders ${PROJECT_SOURCE_DIR}/test/*hh)
add_executable(g4cgalbool_test ${TestSources} ${TestHeaders})
target_compile_options(g4cgalbool_test PRIVATE -Werror)
target_link_libraries(g4cgalbool_test ${Geant4_LIBRARIES} CGAL::CGAL g4cgalboolean)
install(TARGETS g4cgalboolean
EXPORT geant4cgalbooleanTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CGALLibHeaders} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"geant4cgalbooleanConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/cmake/geant4cgalboolean.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/geant4cgalbooleanConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/geant4cgalboolean
)
install(EXPORT geant4cgalbooleanTargets
FILE geant4cgalbooleanTargets.cmake
NAMESPACE geant4cgalboolean::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/geant4cgalboolean/
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/geant4cgalbooleanConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/geant4cgalbooleanConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/geant4cgalboolean/
)