From 79bb624ec8bf5199b281bfc48d77aaf27b9646fa Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 27 Sep 2023 14:03:55 -0400 Subject: [PATCH] reflect: build: retire superseded cmake macros --- cmake/cxx.cmake | 113 +++++++++++++++++++------------------ src/reflect/CMakeLists.txt | 2 +- utest/CMakeLists.txt | 2 +- 3 files changed, 59 insertions(+), 58 deletions(-) diff --git a/cmake/cxx.cmake b/cmake/cxx.cmake index fa6efb8..4084bac 100644 --- a/cmake/cxx.cmake +++ b/cmake/cxx.cmake @@ -1,36 +1,36 @@ -# ---------------------------------------------------------------- -# use this in subdirs that compile c++ code +## ---------------------------------------------------------------- +## use this in subdirs that compile c++ code +## +#macro(xo_include_options target) +# # ---------------------------------------------------------------- +# # PROJECT_SOURCE_DIR: +# # so we can for example write +# # #include "ordinaltree/foo.hpp" +# # from anywhere in the project +# # PROJECT_BINARY_DIR: +# # since generated version file will be in build directory, +# # need that build directory to also appear in +# # compiler's include path +# # +# target_include_directories( +# ${target} PUBLIC +# $ # e.g. for #include "indentlog/scope.hpp" +# $ +# $ # e.g. for #include "Refcounted.hpp" in refcnt/src +# $ +# $ # e.g. for generated config.hpp file +# ) # -macro(xo_include_options target) - # ---------------------------------------------------------------- - # PROJECT_SOURCE_DIR: - # so we can for example write - # #include "ordinaltree/foo.hpp" - # from anywhere in the project - # PROJECT_BINARY_DIR: - # since generated version file will be in build directory, - # need that build directory to also appear in - # compiler's include path - # - target_include_directories( - ${target} PUBLIC - $ # e.g. for #include "indentlog/scope.hpp" - $ - $ # e.g. for #include "Refcounted.hpp" in refcnt/src - $ - $ # e.g. for generated config.hpp file - ) - - # ---------------------------------------------------------------- - # make standard directories for std:: includes explicit - # so that - # (1) they appear in compile_commands.json. - # (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}) - endif() -endmacro() +# # ---------------------------------------------------------------- +# # make standard directories for std:: includes explicit +# # so that +# # (1) they appear in compile_commands.json. +# # (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}) +# endif() +#endmacro() # ---------------------------------------------------------------- # variable @@ -70,29 +70,30 @@ macro(xo_compile_options target) target_compile_options(${target} PRIVATE ${XO_COMPILE_OPTIONS}) endmacro() -# ---------------------------------------------------------------- -# use this for a subdir that builds a library -# EXPORT drives .cmake config files intended for consumption -# by higher-level cmake projects via find_package() +## ---------------------------------------------------------------- +## use this for a subdir that builds a library +## EXPORT drives .cmake config files intended for consumption +## by higher-level cmake projects via find_package() +## +#macro(xo_install_library target) +# install( +# TARGETS ${target} +# EXPORT ${target}Targets +# 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 +# ) +#endmacro() # -macro(xo_install_library target) - install( - TARGETS ${target} - EXPORT ${target}Targets - 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 - ) -endmacro() - -# ---------------------------------------------------------------- -# use this when relying on indentlog [[https://github.com/rconybea/indentlog]] headers +## ---------------------------------------------------------------- +## use this when relying on indentlog [[https://github.com/rconybea/indentlog]] headers +## +#macro(xo_indentlog_dependency target) +# find_package(indentlog REQUIRED) +# #add_dependencies(${target} indentlog) +# target_link_libraries(${target} PUBLIC indentlog) +# #target_include_directories(${target} PUBLIC ${indentlog_DIR}/../../../include) +#endmacro() # -macro(xo_indentlog_dependency target) - find_package(indentlog REQUIRED) - #add_dependencies(${target} indentlog) - target_link_libraries(${target} PUBLIC indentlog) - #target_include_directories(${target} PUBLIC ${indentlog_DIR}/../../../include) -endmacro() diff --git a/src/reflect/CMakeLists.txt b/src/reflect/CMakeLists.txt index d4b772e..bf70947 100644 --- a/src/reflect/CMakeLists.txt +++ b/src/reflect/CMakeLists.txt @@ -17,7 +17,7 @@ set_target_properties(${SELF_LIBRARY_NAME} #target_compile_options(${SELF_LIBRARY_NAME} PRIVATE -Werror -Wall -Wextra) xo_compile_options(${SELF_LIBRARY_NAME}) xo_include_options2(${SELF_LIBRARY_NAME}) -xo_install_library(${SELF_LIBRARY_NAME}) +xo_install_library2(${SELF_LIBRARY_NAME}) # ---------------------------------------------------------------- # dependencies: logutil, ... diff --git a/utest/CMakeLists.txt b/utest/CMakeLists.txt index 80ce49a..7eae282 100644 --- a/utest/CMakeLists.txt +++ b/utest/CMakeLists.txt @@ -4,7 +4,7 @@ set(SELF_EXECUTABLE_NAME utest.reflect) set(SELF_SOURCE_FILES reflect_utest_main.cpp StructReflector.test.cpp VectorTdx.test.cpp StructTdx.test.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)