diff --git a/CMakeLists.txt b/CMakeLists.txt index 86f6de3a..b8553e93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,7 @@ enable_language(CXX) # common XO cmake macros (see proj/xo-cmake) include(xo_macros/xo_cxx) -include(cmake/nestlog.cmake) -include(cmake/code-coverage.cmake) +include(xo_macros/code-coverage) enable_testing() # activate code coverage for all executables + libraries (when -DCODE_COVERAGE=ON) @@ -19,25 +18,7 @@ add_code_coverage() # add_code_coverage_all_targets(EXCLUDE /nix/store/* utest/*) -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED True) - -# always write compile_commands.json -set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "") - -if(NOT USER) - set(USER $ENV{USER}) -endif() - -# hmm. this works if explicitly given with cmake: -# cmake -DCMAKE_INSTALL_PREFIX=/home/roland/local path/to/source -# but not as default -if(NOT CMAKE_INSTALL_PREFIX) - set(CMAKE_INSTALL_PREFIX /home/${USER}/local CACHE STRING "install directory") -endif() -if(NOT CMAKE_INSTALL_RPATH) - set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib CACHE STRING "runpath in installed libraries/executables") -endif() +xo_toplevel_compile_options() add_subdirectory(example) add_subdirectory(utest) @@ -46,10 +27,11 @@ add_subdirectory(utest) # see [[https://stackoverflow.com/questions/47718485/install-and-export-interface-only-library-cmake]] # add_library(indentlog INTERFACE) -target_include_directories(indentlog INTERFACE - $ - $ - ) +xo_include_headeronly_options2(indentlog) +#target_include_directories(indentlog INTERFACE +# $ +# $ +# ) # ---------------------------------------------------------------- # provide find_package() support @@ -60,36 +42,6 @@ xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets xo_install_library2(${PROJECT_NAME}) -#include(CMakePackageConfigHelpers) -#write_basic_package_version_file("${PROJECT_BINARY_DIR}/indentlogConfigVersion.cmake" -# VERSION 0.1 -# COMPATIBILITY AnyNewerVersion -#) -# -#install( -# TARGETS indentlog -# EXPORT indentlogTargets -# LIBRARY DESTINATION lib COMPONENT Runtime -# ARCHIVE DESTINATION lib COMPONENT Development -# RUNTIME DESTINATION bin COMPONENT Runtime -# PUBLIC_HEADER DESTINATION include COMPONENT Development -# BUNDLE DESTINATION bin COMPONENT Runtime -# ) - -#include(CMakePackageConfigHelpers) -#configure_package_config_file( -# "${PROJECT_SOURCE_DIR}/cmake/indentlogConfig.cmake.in" -# "${PROJECT_BINARY_DIR}/indentlogConfig.cmake" -# INSTALL_DESTINATION lib/cmake/indentlog -# ) -# -#install(EXPORT indentlogTargets DESTINATION lib/cmake/indentlog) -#install( -# FILES -# "${PROJECT_BINARY_DIR}/indentlogConfigVersion.cmake" -# "${PROJECT_BINARY_DIR}/indentlogConfig.cmake" -# DESTINATION lib/cmake/indentlog) - # ---------------------------------------------------------------- # install .hpp diff --git a/example/ex1/CMakeLists.txt b/example/ex1/CMakeLists.txt index 6af29d79..a9d1b27d 100644 --- a/example/ex1/CMakeLists.txt +++ b/example/ex1/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(ex1 ex1.cpp) -xo_include_options(ex1) +xo_include_options2(ex1) diff --git a/example/ex2/CMakeLists.txt b/example/ex2/CMakeLists.txt index 1ac5735a..20026b03 100644 --- a/example/ex2/CMakeLists.txt +++ b/example/ex2/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(ex2 ex2.cpp) -xo_include_options(ex2) +xo_include_options2(ex2) diff --git a/example/ex3/CMakeLists.txt b/example/ex3/CMakeLists.txt index d81e0e99..9791a931 100644 --- a/example/ex3/CMakeLists.txt +++ b/example/ex3/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(ex3 ex3.cpp) -xo_include_options(ex3) +xo_include_options2(ex3) diff --git a/example/ex4/CMakeLists.txt b/example/ex4/CMakeLists.txt index 02c1f301..2a6b9c31 100644 --- a/example/ex4/CMakeLists.txt +++ b/example/ex4/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(ex4 ex4.cpp) -xo_include_options(ex4) +xo_include_options2(ex4) diff --git a/example/hello/CMakeLists.txt b/example/hello/CMakeLists.txt index d6f694e6..1ff23000 100644 --- a/example/hello/CMakeLists.txt +++ b/example/hello/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(hello hello.cpp) -xo_include_options(hello) +xo_include_options2(hello) diff --git a/utest/CMakeLists.txt b/utest/CMakeLists.txt index a135895a..19bf25e6 100644 --- a/utest/CMakeLists.txt +++ b/utest/CMakeLists.txt @@ -7,7 +7,7 @@ set(SELF_SOURCE_FILES indentlog_utest_main.cpp) add_executable(${SELF_EXECUTABLE_NAME} ${SELF_SOURCE_FILES}) -xo_include_options(${SELF_EXECUTABLE_NAME}) +xo_include_options2(${SELF_EXECUTABLE_NAME}) add_test(NAME ${SELF_EXECUTABLE_NAME} COMMAND ${SELF_EXECUTABLE_NAME}) target_code_coverage(${SELF_EXECUTABLE_NAME} AUTO ALL)