build: + cmake find_package() support
This commit is contained in:
parent
11092bc4fd
commit
90dcd600c0
3 changed files with 25 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# using indentlog/CMakeLists.txt as model
|
||||
# randomgen/CMakeLists.txt
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
|
|
@ -23,14 +23,14 @@ add_code_coverage()
|
|||
add_code_coverage_all_targets(EXCLUDE /nix/store/* utest/*)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# c++ settings
|
||||
|
||||
set(PROJECT_CXX_FLAGS "-fconcepts-diagnostics-depth=2")
|
||||
# bespoke (usually temporary) c++ settings
|
||||
|
||||
set(PROJECT_CXX_FLAGS "")
|
||||
#set(PROJECT_CXX_FLAGS "-fconcepts-diagnostics-depth=2")
|
||||
add_definitions(${PROJECT_CXX_FLAGS})
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# default install
|
||||
# common include paths etc.
|
||||
|
||||
xo_toplevel_compile_options()
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ xo_toplevel_compile_options()
|
|||
# set CMAKE_INSTALL_PREFIX to analog of /usr
|
||||
# to use .cmake assistants from /usr/lib/cmake/indentlog
|
||||
#
|
||||
#find_package(indentlog REQUIRED)
|
||||
# xo_internal_dependency(..)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
|
@ -48,7 +48,20 @@ add_subdirectory(example)
|
|||
#add_subdirectory(utest)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# output targets
|
||||
|
||||
set(SELF_LIB randomgen)
|
||||
add_library(${SELF_LIB} INTERFACE)
|
||||
xo_include_headeronly_options2(${SELF_LIB})
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# standard install + provide find_package() support
|
||||
|
||||
xo_install_library2(${SELF_LIB})
|
||||
xo_install_include_tree()
|
||||
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# install additional components
|
||||
|
||||
install(TARGETS ex1 DESTINATION bin/randomgen/example)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
$ cd randomgen
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake -DCMAKE_MODULE_PATH=${INSTALL_PREFIX}/share/cmake -DCMAKE_PREFIX_PATH=$(INSTALL_PREFIX) ..
|
||||
$ PREFIX=/usr/local # for example
|
||||
$ cmake -DCMAKE_MODULE_PATH=${PREFIX}/share/cmake -DCMAKE_PREFIX_PATH=$(PREFIX) -DCMAKE_INSTALL_PREFIX=${PREFIX} ..
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
|
|
|||
4
cmake/randomgenConfig.cmake.in
Normal file
4
cmake/randomgenConfig.cmake.in
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/randomgenTargets.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
||||
Loading…
Add table
Add a link
Reference in a new issue