Use scomplex throughout rather than simplcompltype
[libstick.git] / CMakeLists.txt
1 cmake_minimum_required (VERSION 2.6)
2 project (libstick)
3
4 # Set a default build type if none was specified
5 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
6 message(STATUS "Setting build type to 'Release' as none was specified.")
7 set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
8 # Set the possible values of build type for cmake-gui
9 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
10 endif()
11
12 if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
13 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++98 -pedantic")
14 # I would like to use -pedantic, but VTK devs are not sufficiently
15 # pedantic
16 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror")
17 set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed" )
18 endif()
19
20 set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG")
21 if(CMAKE_BUILD_TYPE STREQUAL "Release")
22 # CMAKE_CXX_FLAGS_RELEASE is appended, but we need to prepend -O2 to take
23 # effect
24 set(CMAKE_CXX_FLAGS "-O2 -g ${CMAKE_CXX_FLAGS}")
25 endif()
26
27 set(PACKAGE_STRING libstick)
28 set(PACKAGE_BUGREPORT stefan.huber@ist.ac.at)
29 set(PACKAGE_VERSION 0.2)
30
31 option(WITH_UNITTESTS "Enable unit tests" "OFF")
32
33 add_subdirectory(include)
34 add_subdirectory(lib)
35
36 if(WITH_UNITTESTS)
37 add_subdirectory(tests)
38 enable_testing()
39 add_test(NAME unittests COMMAND tests)
40 endif()
41
42
43 ########### Add uninstall target ###############
44 configure_file(
45 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
46 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
47 IMMEDIATE @ONLY)
48
49 add_custom_target(uninstall
50 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)