indentlog: + hello example + cmake install attempt

This commit is contained in:
Roland Conybeare 2023-09-19 14:34:41 -04:00
commit 468c525470
6 changed files with 25 additions and 14 deletions

View file

@ -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
# $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
# $<INSTALL_INTERFACE:include>
# )
#
#install(TARGETS indentlog
# PUBLIC_HEADER DESTINATION include) # COMPONENT Development
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include)

View file

@ -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()

View file

@ -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)

View file

@ -0,0 +1,2 @@
add_executable(hello hello.cpp)
xo_include_options(hello)

5
example/hello/hello.cpp Normal file
View file

@ -0,0 +1,5 @@
#include <iostream>
int main(int argc, char ** argv) {
std::cout << "Hello, world!" << std::endl;
}

View file

@ -1,6 +0,0 @@
# header-only library
add_library(indentlog INTERFACE)
target_include_directories(indentlog INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)