build: streamline CMAKE_MODULE_PATH interaction

This commit is contained in:
Roland Conybeare 2024-03-15 19:32:04 -04:00
commit 90c20ddae2
3 changed files with 19 additions and 3 deletions

7
.gitignore vendored
View file

@ -1 +1,6 @@
build
# clangd working space (see emacs+lsp)
.cache
# typical cmake build directory (source-tree-nephew)
.build*
# symlink to builddir/compile_commands.json; should be set manually in dev sandbox
compile_commands.json

View file

@ -5,8 +5,7 @@ cmake_minimum_required(VERSION 3.10)
project(xo_statistics VERSION 1.0)
enable_language(CXX)
include(xo_macros/xo_cxx)
include(xo_macros/code-coverage)
include(cmake/xo-bootstrap-macros.cmake)
# ----------------------------------------------------------------
# unit test setup

View file

@ -0,0 +1,12 @@
if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL "prefix"))
# default to typical install location for xo-project-macros
set(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake)
endif()
message("-- CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
message("-- CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
# 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)