build: streamline CMAKE_MODULE_PATH interaction

This commit is contained in:
Roland Conybeare 2024-03-15 19:32:51 -04:00
commit 884eb3acc4
3 changed files with 15 additions and 5 deletions

3
.gitignore vendored
View file

@ -1,7 +1,6 @@
# lsp keeps state here # lsp keeps state here
.cache .cache
# typical build directories # typical build directories
build .build*
ccov
# compile_commands.json symlink -> build/compile_commands.json should be created manually # compile_commands.json symlink -> build/compile_commands.json should be created manually
compile_commands.json compile_commands.json

View file

@ -5,9 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(printjson VERSION 0.1) project(printjson VERSION 0.1)
enable_language(CXX) enable_language(CXX)
# common XO cmake macros (see proj/xo-cmake) # common XO cmake macros (see https://github.com/rconybea/xo-cmake)
include(xo_macros/xo_cxx) include(cmake/xo-bootstrap-macros.cmake)
include(xo_macros/code-coverage)
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# unit test setup # 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)