xo-flatstring: build: streamline/tweak .cmake files
This commit is contained in:
parent
970a91705e
commit
633bbd4047
2 changed files with 12 additions and 26 deletions
|
|
@ -3,19 +3,12 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
|
||||
project(xo_flatstring VERSION 1.0)
|
||||
#enable_language(CXX)
|
||||
|
||||
# common XO cmake macros (see proj/xo-cmake)
|
||||
include(GNUInstallDirs)
|
||||
include(cmake/xo-bootstrap-macros.cmake)
|
||||
|
||||
xo_cxx_toplevel_options2()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# unit test + coverage setup
|
||||
#
|
||||
enable_testing()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# cmake -DCMAKE_BUILD_TYPE=coverage
|
||||
#
|
||||
|
|
@ -29,8 +22,6 @@ set(PROJECT_CXX_FLAGS "")
|
|||
#set(PROJECT_CXX_FLAGS "-fconcepts-diagnostics-depth=2")
|
||||
add_definitions(${PROJECT_CXX_FLAGS})
|
||||
|
||||
xo_toplevel_compile_options()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
add_subdirectory(example)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
# ----------------------------------------------------------------
|
||||
# for example use
|
||||
# for example:
|
||||
# $ PREFIX=/usr/local # for example
|
||||
# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=$PREFIX -B .build
|
||||
#
|
||||
# will set
|
||||
# CMAKE_MODULE_PATH = /usr/local/share/cmake
|
||||
# will get
|
||||
# CMAKE_MODULE_PATH
|
||||
# from xo-cmake-config --cmake-module-path
|
||||
#
|
||||
# and expect .cmake macros in
|
||||
# /usr/local/share/cmake/xo_macros/xo-project-macros.cmake
|
||||
# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED)
|
||||
|
|
@ -17,24 +19,17 @@ endif()
|
|||
|
||||
message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}")
|
||||
|
||||
if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix))
|
||||
message(STATUS "call XO_CMAKE_CONFIG_EXECUTABLE to get XO_CMAKE_MODULE_PATH")
|
||||
# default to typical install location for xo-project-macros
|
||||
execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE XO_CMAKE_MODULE_PATH)
|
||||
message(STATUS "XO_CMAKE_MODULE_PATH=[${XO_CMAKE_MODULE_PATH}]")
|
||||
set(CMAKE_MODULE_PATH ${XO_CMAKE_MODULE_PATH})
|
||||
else()
|
||||
message(STATUS "use already-defined CMAKE_MODULE_PATH=[${CMAKE_MODULE_PATH}]")
|
||||
endif()
|
||||
|
||||
if (NOT XO_SUBMODULE_BUILD)
|
||||
message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
|
||||
if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix))
|
||||
# default to typical install location for xo-project-macros
|
||||
execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE CMAKE_MODULE_PATH)
|
||||
message(STATUS "CMAKE_MODULE_PATH=${XO_CMAKE_MODULE_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# needs to have been installed somewhere on CMAKE_MODULE_PATH,
|
||||
# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX)
|
||||
#
|
||||
#include(xo_macros/xo-project-macros)
|
||||
include(xo_macros/xo_cxx) # not using v1 code-coverage; testing cmake-examples impl instead
|
||||
include(xo_macros/xo_cxx)
|
||||
|
||||
xo_cxx_bootstrap_message()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue