Skip to content

Commit

Permalink
better cmake scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
lganzzzo committed Jan 25, 2019
1 parent 6d6af2c commit cc90da2
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ add_subdirectory(src)
if(OATPP_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()

if(OATPP_INSTALL)
include("cmake/module-install.cmake")
endif()
File renamed without changes.
12 changes: 10 additions & 2 deletions src/module-install.cmake → cmake/module-install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ set(OATPP_MODULE_LIBRARIES
CACHE INTERNAL "oatpp module libraries"
)

#######################################################################################
## calc directories to install (relative to this script)
## dirs should be in ( relative ../src/<dirs>)

foreach(CURR_DIR ${OATPP_THIS_MODULE_DIRECTORIES})
list(APPEND OATPP_DIRS_TO_INSTALL ${CMAKE_CURRENT_LIST_DIR}/../src/${CURR_DIR})
endforeach()

#######################################################################################

include(GNUInstallDirs)
Expand All @@ -56,7 +64,7 @@ install(TARGETS ${OATPP_THIS_MODULE_TARGETS}
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/oatpp-${OATPP_MODULE_VERSION}/${OATPP_MODULE_NAME}"
)

install(DIRECTORY ${OATPP_THIS_MODULE_DIRECTORIES}
install(DIRECTORY ${OATPP_DIRS_TO_INSTALL}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/oatpp-${OATPP_MODULE_VERSION}/${OATPP_MODULE_NAME}"
FILES_MATCHING PATTERN "*.hpp"
)
Expand All @@ -77,7 +85,7 @@ write_basic_package_version_file("${OATPP_MODULE_NAME}ConfigVersion.cmake"
## Take module-config.cmake.in file in this direcory as a template

configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/module-config.cmake.in"
"${CMAKE_CURRENT_LIST_DIR}/module-config.cmake.in"
"${OATPP_MODULE_NAME}Config.cmake"
INSTALL_DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/${OATPP_MODULE_NAME}-${OATPP_MODULE_VERSION}"
Expand Down
7 changes: 0 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,3 @@ target_include_directories(oatpp-test PUBLIC
)

add_dependencies(oatpp-test oatpp)

#######################################################################################################
## INSTALL TARGETS

if(OATPP_INSTALL)
include("module-install.cmake")
endif()
21 changes: 21 additions & 0 deletions utility/module-uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

MODULE_NAME="oatpp"
MODULE_VERSION="0.19.1"

echo "remove include folder: '/usr/local/include/oatpp-$MODULE_VERSION/$MODULE_NAME'"
rm -rf "/usr/local/include/oatpp-$MODULE_VERSION/$MODULE_NAME"

echo "remove cmake package: '/usr/local/lib/cmake/$MODULE_NAME-$MODULE_VERSION'"
rm -rf "/usr/local/lib/cmake/$MODULE_NAME-$MODULE_VERSION"

MODULE_LIB_PATH="/usr/local/lib/oatpp-$MODULE_VERSION"

echo "remove '$MODULE_LIB_PATH/lib$MODULE_NAME.dylib'"
rm "$MODULE_LIB_PATH/lib$MODULE_NAME.dylib"

echo "remove '$MODULE_LIB_PATH/lib$MODULE_NAME.so'"
rm "$MODULE_LIB_PATH/lib$MODULE_NAME.so"

echo "remove '$MODULE_LIB_PATH/lib$MODULE_NAME.a'"
rm "$MODULE_LIB_PATH/lib$MODULE_NAME.a"

0 comments on commit cc90da2

Please sign in to comment.