2018-03-29 13:26:47 +02:00
|
|
|
|
|
|
|
## [main]
|
2018-03-29 12:27:23 +02:00
|
|
|
cmake_minimum_required(VERSION 3.11)
|
|
|
|
|
|
|
|
project(RootSimpleExample311 LANGUAGES CXX)
|
|
|
|
|
|
|
|
find_package(ROOT CONFIG REQUIRED)
|
|
|
|
|
|
|
|
## [modern_fix]
|
|
|
|
target_include_directories(ROOT::Core INTERFACE "${ROOT_INCLUDE_DIRS}")
|
2018-05-01 17:18:27 +02:00
|
|
|
|
|
|
|
add_library(ROOT::Flags_CXX IMPORTED INTERFACE)
|
2018-05-02 10:48:50 +02:00
|
|
|
|
|
|
|
separate_arguments(ROOT_CXX_FLAGS)
|
2018-05-01 17:18:27 +02:00
|
|
|
target_compile_options(ROOT::Flags_CXX INTERFACE ${ROOT_CXX_FLAGS})
|
2018-05-02 10:48:50 +02:00
|
|
|
|
|
|
|
separate_arguments(ROOT_DEFINITIONS)
|
2018-05-01 17:18:27 +02:00
|
|
|
target_compile_definitions(ROOT::Flags_CXX INTERFACE ${ROOT_DEFINITIONS})
|
2018-05-02 10:48:50 +02:00
|
|
|
|
|
|
|
# This fixes a bug in the linker flags
|
|
|
|
string(REPLACE "-L " "-L" ROOT_EXE_LINKER_FLAGS "${ROOT_EXE_LINKER_FLAGS}")
|
|
|
|
separate_arguments(ROOT_EXE_LINKER_FLAGS)
|
|
|
|
# Stuck into using old property method due to separate -L and -l arguments
|
|
|
|
# (A full path to -l is better!)
|
2018-05-01 17:18:27 +02:00
|
|
|
set_property(TARGET ROOT::Flags_CXX PROPERTY
|
|
|
|
INTERFACE_LINK_LIBRARIES ${ROOT_EXE_LINKER_FLAGS})
|
2018-03-29 12:27:23 +02:00
|
|
|
## [modern_fix]
|
|
|
|
|
|
|
|
add_executable(RootSimpleExample311 SimpleExample.cxx)
|
2018-05-01 17:18:27 +02:00
|
|
|
target_link_libraries(RootSimpleExample311 PUBLIC ROOT::Physics ROOT::Flags_CXX)
|
2018-03-29 13:26:47 +02:00
|
|
|
## [main]
|
2018-03-29 12:27:23 +02:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
add_test(NAME RootSimpleExample311 COMMAND RootSimpleExample311)
|