build: streamline CMAKE_MODULE_PATH interaction
This commit is contained in:
parent
6262b043fe
commit
b07ce785c5
5 changed files with 22 additions and 6 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -1,2 +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
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.10)
|
|||
|
||||
project(xo_pydistribution VERSION 1.0)
|
||||
|
||||
include(xo_macros/xo-project-macros)
|
||||
include(cmake/xo-bootstrap-macros.cmake)
|
||||
|
||||
xo_cxx_toplevel_options()
|
||||
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ Assumes `xo-pydistribution` installed to `~/local2/lib`
|
|||
|
||||
```
|
||||
PYTHONPATH=~/local2/lib python
|
||||
>>> import pydistribution
|
||||
>>> dir(pydistribution)
|
||||
>>> import xo_pydistribution
|
||||
>>> dir(xo_pydistribution)
|
||||
['Distribution', 'ExplicitDist', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'normalcdf']
|
||||
>>> from pydistribution import *
|
||||
>>> from xo_pydistribution import *
|
||||
```
|
||||
|
||||
normal distribution
|
||||
|
|
|
|||
12
cmake/xo-bootstrap-macros.cmake
Normal file
12
cmake/xo-bootstrap-macros.cmake
Normal 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)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# xo_pydistribution/src/pydistribution/CMakeLists.txt
|
||||
|
||||
set(SELF_LIB pydistribution)
|
||||
set(SELF_LIB xo_pydistribution)
|
||||
set(SELF_SRCS pydistribution.cpp)
|
||||
|
||||
xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue