forked from AcademySoftwareFoundation/Imath
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (69 loc) · 2.61 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
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenEXR Project.
if(IMATH_BUILD_BOTH_STATIC_SHARED)
if (${CMAKE_VERSION} VERSION_LESS "3.12.0")
message(FATAL_ERROR "CMake 3.12 or newer is required for object library support when building both static and shared libraries")
endif()
cmake_minimum_required(VERSION 3.12)
else()
cmake_minimum_required(VERSION 3.10)
endif()
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Version numbers are maintained in config/version.cmake
include(config/version.cmake)
project(Imath VERSION ${IMATH_VERSION} LANGUAGES C CXX)
# ImathSetup.cmake declares all the configuration variables visible
# in cmake-gui or similar and the rest of the global
# project setup. Check the context to see what is configurable.
include(config/ImathSetup.cmake)
# Config headers and package config files
add_subdirectory(config)
# Utility function for the repeated boilerplate of defining the libraries
include(config/LibraryDefine.cmake)
# Source code is in src/Imath
add_subdirectory(src/Imath)
# Imath_DIR points to the location of ImathConfig.cmake, which tells
# downstream projects where to find Imath, via find_package(Imath).
set(Imath_DIR "${CMAKE_CURRENT_BINARY_DIR}/config" CACHE PATH "" FORCE)
# Add an empty ImathTargets.cmake file for the config to use. It can
# be empty since we already defined the targets in add_subdirectory().
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config/ImathTargets.cmake" "# Dummy file")
option(PYTHON "Set ON to compile PyImath bindings")
if (PYTHON)
add_subdirectory(src/python)
endif()
# If you want to use ctest to configure, build and
# upload the results, cmake has builtin support for
# submitting to CDash, or any server who speaks the
# same protocol
#
# These settings will need to be set for your environment,
# and then a script such as the example in
#
# cmake/SampleCTestScript.cmake
#
# edited and placed into the CI system, then run:
#
# cmake -S cmake/SampleCTestScript.cmake
#
# [or whatever you name the file you edit]
#
#set(CTEST_PROJECT_NAME "Imath")
#set(CTEST_NIGHTLY_START_TIME "01:01:01 UTC")
#set(CTEST_DROP_METHOD "http") # there are others...
#set(CTEST_DROP_SITE "open.cdash.org")
#set(CTEST_DROP_LOCATION "/submit.php?project=MyProject")
#set(CTEST_DROP_SITE_CDASH TRUE)
include(CTest)
if(BUILD_TESTING AND NOT IMATH_IS_SUBPROJECT)
enable_testing()
add_subdirectory(src/ImathTest)
endif()
# Including this module will add a `clang-format` target to the build
# if the clang-format executable can be found. Only do this if we are
# top level.
if(NOT IMATH_IS_SUBPROJECT)
include(cmake/clang-format.cmake)
endif()