mirror of
1
0
Fork 0
modern-cmake/examples/root-simple/CMakeLists.txt

33 lines
872 B
CMake
Raw Normal View History

2018-03-28 22:48:45 +02:00
## [main]
2018-03-28 20:50:38 +02:00
cmake_minimum_required(VERSION 3.1)
2018-03-28 22:48:45 +02:00
project(RootSimpleExample LANGUAGES CXX)
2018-03-28 20:50:38 +02:00
2018-03-28 22:48:45 +02:00
## [find_package]
2018-03-28 20:50:38 +02:00
find_package(ROOT CONFIG REQUIRED)
2018-03-28 22:48:45 +02:00
## [find_package]
2018-03-28 20:50:38 +02:00
message(STATUS "Found ROOT: ${ROOT_VERSION} at ${ROOT_DIR}")
2018-03-28 22:48:45 +02:00
# ROOT targets are missing includes and flags
## [setup_properties]
# Fix for ROOT_CXX_FLAGS not actually being a CMake list
2018-03-28 20:50:38 +02:00
string(REPLACE " " ";" ROOT_CXX_FLAG_LIST "${ROOT_CXX_FLAGS}")
2018-03-28 22:48:45 +02:00
set_property(TARGET ROOT::Core PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}")
set_property(TARGET ROOT::Core APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS ${ROOT_CXX_FLAG_LIST})
## [setup_properties]
2018-03-28 20:50:38 +02:00
2018-03-28 22:48:45 +02:00
## [add_and_link]
2018-03-29 12:27:23 +02:00
add_executable(RootSimpleExample SimpleExample.cxx)
target_link_libraries(RootSimpleExample PUBLIC ROOT::Physics)
2018-03-28 22:48:45 +02:00
## [add_and_link]
## [main]
2018-03-28 20:50:38 +02:00
enable_testing()
2018-03-29 12:27:23 +02:00
add_test(NAME RootSimpleExample COMMAND RootSimpleExample)