build: streamline CMAKE_MODULE_PATH interaction

This commit is contained in:
Roland Conybeare 2024-03-15 19:35:02 -04:00
commit 260f3435e1
3 changed files with 14 additions and 3 deletions

2
.gitignore vendored
View file

@ -3,4 +3,4 @@
# symlink -> build/compile_commands.json should be created manually
compile_commands.json
# typical build directories
build
.build*

View file

@ -6,8 +6,7 @@ project(webutil VERSION 1.0)
enable_language(CXX)
# common XO cmake macros (see proj/xo-cmake)
include(xo_macros/xo_cxx)
include(xo_macros/code-coverage)
include(cmake/xo-bootstrap-macros.cmake)
# ----------------------------------------------------------------
# unit test setup (no unit tests yet, but want 'make tests' to do something)

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)