-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
86 lines (70 loc) · 2.28 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
85
86
INCLUDE(FindPkgConfig)
option(LICENSE_GPL "Build GPL components" OFF)
project(refinery)
cmake_minimum_required(VERSION 2.8.2)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-Wall")
if (CMAKE_BUILD_TYPE MATCHES Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
endif()
endif()
# Includes
include_directories(${refinery_SOURCE_DIR}/include)
if (LICENSE_GPL)
include_directories(${refinery_SOURCE_DIR}/include/licensed/gpl)
endif()
# Shared library
file(GLOB sources src/*.cc)
if (LICENSE_GPL)
pkg_check_modules(EXIV2 REQUIRED exiv2>=0.20)
include_directories(SYSTEM ${EXIV2_INCLUDE_DIRS})
file(GLOB gpl_sources src/licensed/gpl/*.cc)
set(sources ${sources} ${gpl_sources})
endif()
add_library(refinery-0.1 SHARED ${sources})
set_target_properties(refinery-0.1 PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
if (LICENSE_GPL)
target_link_libraries(refinery-0.1 exiv2)
endif()
# Binaries
add_executable(bin/raw2ppm util/raw2ppm.cc)
add_dependencies(bin/raw2ppm refinery-0.1)
target_link_libraries(bin/raw2ppm refinery-0.1)
# Testing
enable_testing()
find_package(GTest REQUIRED)
file(GLOB gtest_sources test/*.cc)
if (LICENSE_GPL)
file(GLOB gtest_sources_gpl test/licensed/gpl/*.cc)
set(gtest_sources ${gtest_sources} ${gtest_sources_gpl})
endif()
add_executable(test/gtest_main ${gtest_sources})
add_dependencies(test/gtest_main refinery-0.1)
include_directories(${GTEST_INCLUDE_DIRS})
target_link_libraries(test/gtest_main
pthread ${GTEST_BOTH_LIBRARIES} refinery-0.1)
if (LICENSE_GPL)
target_link_libraries(test/gtest_main exiv2)
endif()
add_test(AllTestsInGtestMain test/gtest_main)
# Docs
find_package(Doxygen)
if (DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile)
add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile)
endif(DOXYGEN_FOUND)
# Bindings
add_subdirectory(bindings)
# Installation
install(TARGETS refinery-0.1
LIBRARY DESTINATION lib)
install(DIRECTORY include/refinery
DESTINATION include/refinery-0.1
FILES_MATCHING PATTERN "*.h")
if (LICENSE_GPL)
install(TARGETS bin/raw2ppm
RUNTIME DESTINATION bin)
install(DIRECTORY include/licensed/gpl/refinery
DESTINATION include/refinery-0.1)
endif()