build: streamline CMAKE_MODULE_PATH interaction

This commit is contained in:
Roland Conybeare 2024-03-15 19:35:34 -04:00
commit 9893b71483
4 changed files with 25 additions and 3 deletions

2
.gitignore vendored
View file

@ -1,6 +1,6 @@
# lsp keeps state here
.cache
# typical build directory
build
.build*
# lsp: symlink to file in build directory (established manually)
compile_commands.json

View file

@ -6,8 +6,7 @@ project(xo_pywebutil VERSION 0.1)
enable_language(CXX)
# common XO cmake macros (see github.com:Rconybea/xo-cmake)
include(xo_macros/xo_cxx)
include(xo_macros/code-coverage)
include(cmake/xo-bootstrap-macros.cmake)
# ----------------------------------------------------------------
# unit test setup

View file

@ -23,6 +23,17 @@ $ make install
```
(also see .github/workflows/main.yml)
## Examples
Assumes `xo-pywebutil` installed to `~/local2/lib`
```
$ PYTHONPATH=~/local2/lib:$PYTHONPATH python
>>> import xo_pywebutil
>>> dir(xo_pywebutil)
['EndpointDescr', 'StreamEndpointDescr', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']
>>> from xo_pywebutil import *
```
## Development
### build for unit test coverage

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)