more improvements on the cmake build system.

This commit is contained in:
2026-04-17 09:15:07 +02:00
parent 9178b5ef0e
commit e60a835f67
4 changed files with 13 additions and 29 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ add_executable(lf_gl
PLGKT_LF.cpp
)
set_property(TARGET lf_gl PROPERTY CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set_property(TARGET lf_gl PROPERTY CXX_STANDARD_REQUIRED ON)
target_include_directories(lf_gl
BEFORE PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
+4 -7
View File
@@ -3,14 +3,11 @@ cmake_minimum_required(VERSION 3.17)
project(rgeHandlerTest VERSION 0.9 LANGUAGES CXX)
include(GNUInstallDirs)
#--- check for ROOT -----------------------------------------------------------
find_package(ROOT 6.18 REQUIRED COMPONENTS Gui MathMore Minuit2 XMLParser)
if (ROOT_mathmore_FOUND)
execute_process(COMMAND root-config --bindir OUTPUT_VARIABLE ROOT_BINDIR)
string(STRIP ${ROOT_BINDIR} ROOT_BINDIR)
execute_process(COMMAND root-config --version OUTPUT_VARIABLE ROOT_VERSION)
string(STRIP ${ROOT_VERSION} ROOT_VERSION)
message("-- Found ROOT: ${ROOT_BINDIR} (found version: ${ROOT_VERSION})")
#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
include(${ROOT_USE_FILE})
endif (ROOT_mathmore_FOUND)
@@ -33,8 +30,8 @@ target_link_libraries(rgeHandlerTest ${ROOT_LIBRARIES} PRgeHandler)
install(
TARGETS
rgeHandlerTest
RUNTIME DESTINATION
bin
RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}
)
+8 -16
View File
@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.17)
project(spirit_fcn_test VERSION 0.1 LANGUAGES CXX)
include(GNUInstallDirs)
#--- set a default build type if none was specified ---------------------------
set(default_build_type "Debug")
@@ -21,11 +23,6 @@ find_package(PkgConfig REQUIRED)
#--- check for ROOT -----------------------------------------------------------
find_package(ROOT 6.18 REQUIRED COMPONENTS Gui MathMore Minuit2 XMLParser)
if (ROOT_mathmore_FOUND)
execute_process(COMMAND root-config --bindir OUTPUT_VARIABLE ROOT_BINDIR)
string(STRIP ${ROOT_BINDIR} ROOT_BINDIR)
execute_process(COMMAND root-config --version OUTPUT_VARIABLE ROOT_VERSION)
string(STRIP ${ROOT_VERSION} ROOT_VERSION)
message("-- Found ROOT: ${ROOT_BINDIR} (found version: ${ROOT_VERSION})")
#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
include(${ROOT_USE_FILE})
endif (ROOT_mathmore_FOUND)
@@ -33,16 +30,11 @@ endif (ROOT_mathmore_FOUND)
#--- check for boost ----------------------------------------------------------
find_package(Boost QUIET)
if (Boost_VERSION VERSION_GREATER_EQUAL "1.89")
find_package(Boost REQUIRED
COMPONENTS
filesystem
)
find_package(Boost REQUIRED COMPONENTS filesystem)
set(BOOST_LINK_LIBS Boost::filesystem)
else (Boost_VERSION VERSION_GREATER_EQUAL "1.89")
find_package(Boost REQUIRED
COMPONENTS
system
filesystem
)
find_package(Boost REQUIRED COMPONENTS system filesystem)
set(BOOST_LINK_LIBS Boost::filesystem Boost::system)
endif (Boost_VERSION VERSION_GREATER_EQUAL "1.89")
#--- create executable --------------------------------------------------------
@@ -61,7 +53,7 @@ target_include_directories(spirit_fcn_test
#--- link libraries -----------------------------------------------------------
target_link_libraries(spirit_fcn_test
${ROOT_LIBRARIES}
${Boost_LIBRARIES}
${BOOST_LINK_LIBS}
)
#--- installation info --------------------------------------------------------
@@ -69,5 +61,5 @@ install(
TARGETS
spirit_fcn_test
RUNTIME DESTINATION
bin
${CMAKE_INSTALL_BINDIR}
)
-5
View File
@@ -62,11 +62,6 @@ find_package(Git REQUIRED)
#--- check for ROOT -----------------------------------------------------------
find_package(ROOT 6.18 REQUIRED COMPONENTS Gui MathMore Minuit2 XMLParser)
if (ROOT_mathmore_FOUND)
execute_process(COMMAND root-config --bindir OUTPUT_VARIABLE ROOT_BINDIR)
string(STRIP ${ROOT_BINDIR} ROOT_BINDIR)
execute_process(COMMAND root-config --version OUTPUT_VARIABLE ROOT_VERSION)
string(STRIP ${ROOT_VERSION} ROOT_VERSION)
message("-- Found ROOT: ${ROOT_BINDIR} (found version: ${ROOT_VERSION})")
#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
include(${ROOT_USE_FILE})
endif (ROOT_mathmore_FOUND)