Skip to content

Commit

Permalink
introduce cmake options to install and apply clang tidy conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnrd committed Jul 25, 2024
1 parent dfdac2c commit 65dff1f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ cmake_policy(SET CMP0068 NEW)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(BUILD_WITH_INSTALL_NAME_DIR ON)

if (NOT DEFINED LF_REACTOR_CPP_SUFFIX)
option(REACTOR_CPP_PRINT_STATISTICS "Print statistics after execution" OFF)
option(REACTOR_CPP_TRACE "Enable tracing" OFF)
option(REACTOR_CPP_VALIDATE "Enable runtime validation" ON)
option(REACTOR_CPP_INSTALL "Install the reactor-cpp target" On)
option(REACTOR_CPP_CLANG_TIDY "Enable building with clang-tidy " On)

if (REACTOR_CPP_CLANG_TIDY AND NOT DEFINED LF_REACTOR_CPP_SUFFIX)
find_program(CLANG_TIDY clang-tidy)
if (CLANG_TIDY)
set(CMAKE_CXX_CLANG_TIDY clang-tidy; -header-filter=reactor-cpp/\(.*\)\\.hh; -warnings-as-errors=*;)
Expand All @@ -43,9 +49,6 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

option(REACTOR_CPP_PRINT_STATISTICS "Print statistics after execution" OFF)
option(REACTOR_CPP_TRACE "Enable tracing" OFF)
option(REACTOR_CPP_VALIDATE "Enable runtime validation" ON)
if (NOT DEFINED REACTOR_CPP_LOG_LEVEL)
set(REACTOR_CPP_LOG_LEVEL 3)
endif()
Expand Down
24 changes: 13 additions & 11 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,19 @@ set_target_properties(${LIB_TARGET} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1)

if(DEFINED LF_REACTOR_CPP_SUFFIX)
install(FILES "${PROJECT_BINARY_DIR}/include/reactor-cpp/config.hh" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIB_TARGET}/reactor-cpp")
else()
install(FILES "${PROJECT_BINARY_DIR}/include/reactor-cpp/config.hh" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/reactor-cpp")
endif()
if(REACTOR_CPP_INSTALL)
if(DEFINED LF_REACTOR_CPP_SUFFIX)
install(FILES "${PROJECT_BINARY_DIR}/include/reactor-cpp/config.hh" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIB_TARGET}/reactor-cpp")
else()
install(FILES "${PROJECT_BINARY_DIR}/include/reactor-cpp/config.hh" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/reactor-cpp")
endif()

install(TARGETS ${LIB_TARGET} EXPORT ${LIB_TARGET}Config
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" OPTIONAL
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" OPTIONAL
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
install(TARGETS ${LIB_TARGET} EXPORT ${LIB_TARGET}Config
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" OPTIONAL
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" OPTIONAL
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)

install(EXPORT ${LIB_TARGET}Config DESTINATION share/${LIB_TARGET}/cmake)
install(EXPORT ${LIB_TARGET}Config DESTINATION share/${LIB_TARGET}/cmake)

export(TARGETS ${PROJECT_NAME} FILE ${LIB_TARGET}Config.cmake)
export(TARGETS ${PROJECT_NAME} FILE ${LIB_TARGET}Config.cmake)
endif()

0 comments on commit 65dff1f

Please sign in to comment.