-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add cmake find_package() support, to be tested. * bugfix to in mutilsConfig.cmake * minor optimization; remove Makefile * fix include and lib path
- Loading branch information
1 parent
e0433d7
commit 7072b25
Showing
3 changed files
with
41 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,49 @@ | ||
cmake_minimum_required (VERSION 3.1) | ||
project (mutils) | ||
|
||
#Versions | ||
set(mutils_VERSION 1.0) | ||
|
||
#CXX FLAGS | ||
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++14 -fPIC") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}") | ||
set(CMAKE_CXX_FLAGS_DEBUG "-std=c++14 -fPIC -g") | ||
set(CMAKE_SHARED_LINKER_FLAGS "-shared --enable-new-dtags") | ||
|
||
include_directories(${mutils_SOURCE_DIR}/include) | ||
|
||
add_library(mutils SHARED utils.cpp abiutils.cpp) | ||
target_include_directories(mutils PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) | ||
|
||
#Make install | ||
install(TARGETS mutils EXPORT mutils | ||
LIBRARY DESTINATION lib) | ||
install(DIRECTORY include/mutils | ||
DESTINATION include) | ||
|
||
include(CMakePackageConfigHelpers) | ||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/mutils/mutilsConfigVersion.cmake" | ||
VERSION ${mutils_VERSION} | ||
COMPATIBILITY AnyNewerVersion | ||
) | ||
|
||
export (EXPORT mutils | ||
FILE "${CMAKE_CURRENT_BINARY_DIR}/mutils/mutilsTargets.cmake" | ||
) | ||
|
||
configure_file (mutilsConfig.cmake | ||
"${CMAKE_CURRENT_BINARY_DIR}/mutils/mutilsConfig.cmake" | ||
COPYONLY | ||
) | ||
|
||
set(ConfigPackageLocation lib/cmake/mutils) | ||
install(EXPORT mutils | ||
FILE mutilsTargets.cmake | ||
DESTINATION ${ConfigPackageLocation} | ||
) | ||
|
||
set_target_properties(mutils PROPERTIES PUBLIC_HEADER "include/mutils/17_type_utils.hpp;include/mutils/17utils.hpp;include/mutils/AtScopeEnd.hpp;include/mutils/CTString.hpp;include/mutils/CTString_decl.hpp;include/mutils/CTString_impl.hpp;include/mutils/CTString_macro.hpp;include/mutils/CTString_split.hpp;include/mutils/CTString_strip_paren_group.hpp;include/mutils/FunctionalMap.hpp;include/mutils/Hertz.hpp;include/mutils/PrintableObject.hpp;include/mutils/abiutils.hpp;include/mutils/args-finder.hpp;include/mutils/argswrapper.hpp;include/mutils/as_value.hpp;include/mutils/backtrace.hpp;include/mutils/cexprutils.hpp;include/mutils/compile-time-lambda.hpp;include/mutils/compile-time-tuple.hpp;include/mutils/cstring.hpp;include/mutils/extras;include/mutils/filter-varargs.hpp;include/mutils/macro_utils.hpp;include/mutils/mutils.hpp;include/mutils/peano.hpp;include/mutils/private_access.hpp;include/mutils/restrict.hpp;include/mutils/tuple_extras.hpp;include/mutils/type_utils.hpp;include/mutils/typelist.hpp;include/mutils/typeset.hpp;include/mutils/variant.hpp") | ||
install(TARGETS mutils | ||
LIBRARY DESTINATION lib | ||
PUBLIC_HEADER DESTINATION include/mutils/) | ||
install( | ||
FILES | ||
mutilsConfig.cmake | ||
"${CMAKE_CURRENT_BINARY_DIR}/mutils/mutilsConfigVersion.cmake" | ||
DESTINATION ${ConfigPackageLocation} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
set(mutils_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") | ||
set(mutils_LIBRARIES "-L${CMAKE_INSTALL_PREFIX}/lib -lmutils") |