Skip to content
Snippets Groups Projects

[meta,cmake] Restructure project and introduce CMake tooling

Merged Giovanna Lazzari Miotto requested to merge feature/cmake-migration into main
Compare and Show latest version
1 file
+ 3
2
Compare changes
  • Side-by-side
  • Inline
+ 3
2
@@ -31,6 +31,7 @@ add_library(LibSCDAQ ${SOURCE_FILES})
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${SCDAQ_CMAKE_MODS_DIR}")
set(Boost_USE_MULTITHREADED ON)
set(micron_USE_STATIC_LIBS ON)
set(Threads_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(crypto REQUIRED MODULE)
@@ -47,14 +48,14 @@ find_library(micron_STATIC_LIBRARY
if (Boost_FOUND AND TBB_FOUND AND CURL_FOUND)
# For older compilers that do not devise *.cc as C++
set_target_properties(LibSCDAQ PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(${SCDAQ_TARGET} PROPERTIES LINKER_LANGUAGE CXX)
# Build library and link to dependencies
target_include_directories(LibSCDAQ PRIVATE ${Boost_INCLUDE_DIRS} ${CURL_INCLUDE_DIR})
target_link_libraries(LibSCDAQ PUBLIC ${Boost_LIBRARIES} ${CURL_LIBRARIES} ${TBB_LIBRARIES} ${Threads_LIBRARIES} crypto micron)
target_link_libraries(LibSCDAQ PUBLIC ${Boost_LIBRARIES} ${CURL_LIBRARIES} ${TBB_LIBRARIES} -pthread crypto micron)
# Public options for library are imposed on dependants (i.e., main executable)
target_compile_options(LibSCDAQ PUBLIC -std=c++11 -Wall -Wextra -Wpedantic)
# Build main executable and link it to SCDAQ library
add_executable(${SCDAQ_TARGET} ${SCDAQ_SOURCE_DIR}/scdaq.cc)
set_target_properties(${SCDAQ_TARGET} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${SCDAQ_TARGET} PUBLIC LibSCDAQ)
# Toggle CLI Debug build option
target_compile_definitions(${SCDAQ_TARGET} PRIVATE $<$<CONFIG:Debug>: ${SCDAQ_TARGET}_DEBUG=1 >)
Loading