From 468c525470ccf66cd841ddb810c7835d638fec50 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 19 Sep 2023 14:34:41 -0400 Subject: [PATCH] indentlog: + hello example + cmake install attempt --- CMakeLists.txt | 24 +++++++++++++++++------- cmake/nestlog.cmake | 3 +-- example/CMakeLists.txt | 1 + example/hello/CMakeLists.txt | 2 ++ example/hello/hello.cpp | 5 +++++ include/CMakeLists.txt | 6 ------ 6 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 example/hello/CMakeLists.txt create mode 100644 example/hello/hello.cpp delete mode 100644 include/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index aeeda3ed..d819b716 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,13 +4,23 @@ project(nestlog VERSION 0.1) enable_language(CXX) enable_testing() -include(cmake/nestlog.cmake) - -add_subdirectory(include) -add_subdirectory(example) - -# this doesn't work in include/CMakeLists.txt -install(TARGETS indentlog DESTINATION include) +# always write compile_commands.json +set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "") set(CMAKE_INSTALL_PREFIX /home/roland/local) set(CMAKE_INSTALL_RPATH /home/roland/local/lib) + +include(cmake/nestlog.cmake) +add_subdirectory(example) + +# header-only library +#add_library(indentlog INTERFACE) +#target_include_directories(indentlog INTERFACE +# $ +# $ +# ) +# +#install(TARGETS indentlog +# PUBLIC_HEADER DESTINATION include) # COMPONENT Development + +install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include) diff --git a/cmake/nestlog.cmake b/cmake/nestlog.cmake index 30736007..4a1a26ae 100644 --- a/cmake/nestlog.cmake +++ b/cmake/nestlog.cmake @@ -25,7 +25,6 @@ macro(xo_include_options target) # (2) clangd (run from emacs lsp-mode) can find them # if(CMAKE_EXPORT_COMPILE_COMMANDS) - set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES - ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) + set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) endif() endmacro() diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 7f8eb99d..0f629f7a 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -7,6 +7,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "") #include(cmake/FindSphinx.cmake) +add_subdirectory(hello) add_subdirectory(ex1) add_subdirectory(ex2) add_subdirectory(ex3) diff --git a/example/hello/CMakeLists.txt b/example/hello/CMakeLists.txt new file mode 100644 index 00000000..d6f694e6 --- /dev/null +++ b/example/hello/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(hello hello.cpp) +xo_include_options(hello) diff --git a/example/hello/hello.cpp b/example/hello/hello.cpp new file mode 100644 index 00000000..5147511e --- /dev/null +++ b/example/hello/hello.cpp @@ -0,0 +1,5 @@ +#include + +int main(int argc, char ** argv) { + std::cout << "Hello, world!" << std::endl; +} diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt deleted file mode 100644 index 72fcb50d..00000000 --- a/include/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# header-only library -add_library(indentlog INTERFACE) -target_include_directories(indentlog INTERFACE - $ - $ - )