-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
61 lines (48 loc) · 1.78 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
cmake_minimum_required(VERSION 2.8.10)
project(ptextools CXX)
set(ptexutils_VERSION 0.1.0)
set(PYTHON_INSTALL_DIR "python" CACHE PATH "python module install dir")
set(BIN_INSTALL_DIR "bin" CACHE PATH "executable install dir")
set(INCLUDE_INSTALL_DIR "include" CACHE PATH "Include install dir")
set(LIB_INSTALL_DIR "lib" CACHE PATH "Library install dir")
set(BUILD_PYTHON_MODULE ON CACHE BOOL "Should python module be built")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(PTex REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Boost COMPONENTS filesystem system REQUIRED)
if (BUILD_PYTHON_MODULE)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
if ( NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING )
message ( FATAL_ERROR "Version mismatch between python interpreter and libraries")
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-deprecated -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined -Wl,-z,defs -Wl,-O2 -std=c++11")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()
add_subdirectory(src/ptex_utils)
if (BUILD_PYTHON_MODULE)
install(FILES ptexutils/__init__.py
DESTINATION ${PYTHON_INSTALL_DIR}/ptexutils/)
endif()
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/PtexUtilsConfigVersion.cmake"
VERSION ${ptexutils_VERSION}
COMPATIBILITY SameMajorVersion
)
configure_file(PtexUtilsConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/src/ptex_utils/PtexUtilsConfig.cmake"
COPYONLY
)
install(
FILES
PtexUtilsConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/PtexUtilsConfigVersion.cmake"
DESTINATION
${LIB_INSTALL_DIR}/cmake/ptexutils
COMPONENT
dev
)