File: CMakeLists.txt

package info (click to toggle)
ifcplusplus 0~git20190402.13744d5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 16,716 kB
  • sloc: cpp: 199,083; makefile: 31
file content (57 lines) | stat: -rw-r--r-- 2,083 bytes parent folder | download | duplicates (2)
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
CMAKE_MINIMUM_REQUIRED (VERSION 3.7.2)

# Set a default build type if none was specified https://blog.kitware.com/cmake-and-the-default-build-type/
set(default_build_type "Release")
 
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
  set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
      STRING "Choose the type of build." FORCE)
  # Set the possible values of build type for cmake-gui
  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
    "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

project(IFCPP)
MESSAGE(STATUS "------------------------------------------------------------------------")

OPTION(BUILD_VIEWER_APPLICATION "Build the viewer example application" ON)
OPTION(BUILD_STATIC_LIBRARY "Build static library" ON)

IF(NOT WIN32)
    IF("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
        IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
            SET_PROPERTY(DIRECTORY APPEND PROPERTY
                COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG>
            )
        ENDIF()
    ENDIF()
    set(CMAKE_POSITION_INDEPENDENT_CODE ON)
ELSE(NOT WIN32)
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ENDIF(NOT WIN32)

SET(CARVE_SOURCE_DIR ${IFCPP_SOURCE_DIR}/external/Carve)
SET(CARVE_BINARY_DIR ${IFCPP_BINARY_DIR})
SET(IFCPP_CONFIG_DIR "share/IFCPP/cmake")
ADD_SUBDIRECTORY (external/Carve)
ADD_SUBDIRECTORY (IfcPlusPlus)

# Install configuration file
INCLUDE(CMakePackageConfigHelpers)
SET(config_file_input  "${CMAKE_SOURCE_DIR}/cmake/IFCPPConfig.cmake.in")
SET(config_file_output "${CMAKE_BINARY_DIR}/cmake/IFCPPConfig.cmake")

CONFIGURE_PACKAGE_CONFIG_FILE(
  ${config_file_input}
  ${config_file_output}
  INSTALL_DESTINATION ${IFCPP_CONFIG_DIR})

INSTALL(
  FILES ${config_file_output}
  DESTINATION ${IFCPP_CONFIG_DIR})

IF(BUILD_VIEWER_APPLICATION)
  ADD_SUBDIRECTORY (examples/SimpleViewerExampleQt)
ENDIF()