* Use Find_Package to find local packages * Improved toolmaster
| @@ -20,8 +20,11 @@ If ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" ) | |||||
| EndIf ( ) | EndIf ( ) | ||||
| # Includes | |||||
| Include ( CTest ) | |||||
| Include ( GNUInstallDirs ) | |||||
| # Projects ######################################################################################## | # Projects ######################################################################################## | ||||
| Message ( WARNING "Please configure the subprojects of this project group!" ) | Message ( WARNING "Please configure the subprojects of this project group!" ) | ||||
| Add_SubDirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/projects/libhelloworld ) | |||||
| Add_SubDirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/projects/helloworld ) | |||||
| # Find_Package ( <package> ) | |||||
| @@ -20,29 +20,12 @@ EndIf ( ) | |||||
| # Project ######################################################################################### | # Project ######################################################################################### | ||||
| # Version | |||||
| Set ( HELLOWORLD_VERSION_MAJOR 1 ) | |||||
| Set ( HELLOWORLD_VERSION_MINOR 0 ) | |||||
| Set ( HELLOWORLD_VERSION_PATCH 0 ) | |||||
| Set ( HELLOWORLD_VERSION_BUILD 0 ) | |||||
| Set ( HELLOWORLD_VERSION_SHORT "${HELLOWORLD_VERSION_MAJOR}.${HELLOWORLD_VERSION_MINOR}" ) | |||||
| Set ( HELLOWORLD_VERSION "${HELLOWORLD_VERSION_SHORT}.${HELLOWORLD_VERSION_PATCH}.${HELLOWORLD_VERSION_BUILD}" ) | |||||
| Set ( HELLOWORLD_NAME "helloworld-${HELLOWORLD_VERSION_SHORT}" ) | |||||
| # Install directories | |||||
| Set ( HELLOWORLD_INSTALL_DIR_BIN "bin" ) | |||||
| # Project | |||||
| Include ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/helloworld-var.cmake" ) | |||||
| Project ( helloworld | Project ( helloworld | ||||
| DESCRIPTION "A simple library" | DESCRIPTION "A simple library" | ||||
| VERSION "${HELLOWORLD_VERSION}" ) | VERSION "${HELLOWORLD_VERSION}" ) | ||||
| Include ( CTest ) | Include ( CTest ) | ||||
| # C Standard | |||||
| Set ( CMAKE_C_STANDARD 11 ) | |||||
| Set ( CMAKE_CXX_STANDARD 17 ) | |||||
| Set ( CMAKE_C_STANDARD_REQUIRED ON ) | |||||
| Set ( CMAKE_CXX_STANDARD_REQUIRED ON ) | |||||
| Include ( GNUInstallDirs ) | |||||
| # Subdirectories | # Subdirectories | ||||
| Add_SubDirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/src ) | Add_SubDirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/src ) | ||||
| @@ -0,0 +1,17 @@ | |||||
| # Version | |||||
| Set ( HELLOWORLD_VERSION_MAJOR 1 ) | |||||
| Set ( HELLOWORLD_VERSION_MINOR 0 ) | |||||
| Set ( HELLOWORLD_VERSION_PATCH 0 ) | |||||
| Set ( HELLOWORLD_VERSION_BUILD 0 ) | |||||
| Set ( HELLOWORLD_VERSION_SHORT "${HELLOWORLD_VERSION_MAJOR}.${HELLOWORLD_VERSION_MINOR}" ) | |||||
| Set ( HELLOWORLD_VERSION "${HELLOWORLD_VERSION_SHORT}.${HELLOWORLD_VERSION_PATCH}.${HELLOWORLD_VERSION_BUILD}" ) | |||||
| Set ( HELLOWORLD_NAME "helloworld-${HELLOWORLD_VERSION_SHORT}" ) | |||||
| # Install directories | |||||
| Set ( HELLOWORLD_INSTALL_DIR_BIN "bin" ) | |||||
| # C Standard | |||||
| Set ( CMAKE_C_STANDARD 11 ) | |||||
| Set ( CMAKE_CXX_STANDARD 17 ) | |||||
| Set ( CMAKE_C_STANDARD_REQUIRED ON ) | |||||
| Set ( CMAKE_CXX_STANDARD_REQUIRED ON ) | |||||
| @@ -42,6 +42,9 @@ Target_Link_Libraries ( helloworld-objects | |||||
| Set ( HELLOWORLD_MAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) | Set ( HELLOWORLD_MAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) | ||||
| Add_Executable ( helloworld ${HELLOWORLD_MAIN_FILE} ) | Add_Executable ( helloworld ${HELLOWORLD_MAIN_FILE} ) | ||||
| Set_Target_Properties ( helloworld | |||||
| PROPERTIES | |||||
| VERSION ${HELLOWORLD_VERSION} ) | |||||
| Target_Link_Libraries ( helloworld | Target_Link_Libraries ( helloworld | ||||
| PUBLIC | PUBLIC | ||||
| helloworld-objects ) | helloworld-objects ) | ||||
| @@ -20,31 +20,12 @@ EndIf ( ) | |||||
| # Project ######################################################################################### | # Project ######################################################################################### | ||||
| # Version | |||||
| Set ( LIBHELLOWORLD_VERSION_MAJOR 1 ) | |||||
| Set ( LIBHELLOWORLD_VERSION_MINOR 0 ) | |||||
| Set ( LIBHELLOWORLD_VERSION_PATCH 0 ) | |||||
| Set ( LIBHELLOWORLD_VERSION_BUILD 0 ) | |||||
| Set ( LIBHELLOWORLD_VERSION_SHORT "${LIBHELLOWORLD_VERSION_MAJOR}.${LIBHELLOWORLD_VERSION_MINOR}" ) | |||||
| Set ( LIBHELLOWORLD_VERSION "${LIBHELLOWORLD_VERSION_SHORT}.${LIBHELLOWORLD_VERSION_PATCH}.${LIBHELLOWORLD_VERSION_BUILD}" ) | |||||
| Set ( LIBHELLOWORLD_NAME "libhelloworld-${LIBHELLOWORLD_VERSION_SHORT}" ) | |||||
| # Install directories | |||||
| Set ( LIBHELLOWORLD_INSTALL_DIR_INCLUDE "include/${LIBHELLOWORLD_NAME}" ) | |||||
| Set ( LIBHELLOWORLD_INSTALL_DIR_LIB "lib/${LIBHELLOWORLD_NAME}" ) | |||||
| Set ( LIBHELLOWORLD_INSTALL_DIR_SHARE "share/${LIBHELLOWORLD_NAME}" ) | |||||
| # Project | |||||
| Include ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/libhelloworld-var.cmake" ) | |||||
| Project ( libhelloworld | Project ( libhelloworld | ||||
| DESCRIPTION "A simple library" | DESCRIPTION "A simple library" | ||||
| VERSION "${LIBHELLOWORLD_VERSION}" ) | VERSION "${LIBHELLOWORLD_VERSION}" ) | ||||
| Include ( CTest ) | Include ( CTest ) | ||||
| # C Standard | |||||
| Set ( CMAKE_C_STANDARD 11 ) | |||||
| Set ( CMAKE_CXX_STANDARD 17 ) | |||||
| Set ( CMAKE_C_STANDARD_REQUIRED ON ) | |||||
| Set ( CMAKE_CXX_STANDARD_REQUIRED ON ) | |||||
| Include ( GNUInstallDirs ) | |||||
| # Subdirectories | # Subdirectories | ||||
| Add_SubDirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/src ) | Add_SubDirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/src ) | ||||
| @@ -61,6 +42,7 @@ Configure_File ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/libhellow | |||||
| Set ( ConfigPackageLocation "${LIBHELLOWORLD_INSTALL_DIR_SHARE}/cmake" ) | Set ( ConfigPackageLocation "${LIBHELLOWORLD_INSTALL_DIR_SHARE}/cmake" ) | ||||
| Install ( EXPORT libhelloworld | Install ( EXPORT libhelloworld | ||||
| NAMESPACE libhelloworld:: | |||||
| DESTINATION ${ConfigPackageLocation} ) | DESTINATION ${ConfigPackageLocation} ) | ||||
| Install ( FILES | Install ( FILES | ||||
| "${CMAKE_CURRENT_BINARY_DIR}/cmake/libhelloworld-config.cmake" | "${CMAKE_CURRENT_BINARY_DIR}/cmake/libhelloworld-config.cmake" | ||||
| @@ -2,3 +2,7 @@ | |||||
| Get_Filename_Component ( CURRENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH ) | Get_Filename_Component ( CURRENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH ) | ||||
| Include ( ${CURRENT_DIR}/libhelloworld.cmake ) | Include ( ${CURRENT_DIR}/libhelloworld.cmake ) | ||||
| Message ( WARNING "Please configure the dependencies of this package!" ) | |||||
| # Include ( CMakeFindDependencyMacro ) | |||||
| # Find_Dependency ( <dependency> ) | |||||
| @@ -0,0 +1,20 @@ | |||||
| # Version | |||||
| Set ( LIBHELLOWORLD_VERSION_MAJOR 1 ) | |||||
| Set ( LIBHELLOWORLD_VERSION_MINOR 0 ) | |||||
| Set ( LIBHELLOWORLD_VERSION_PATCH 0 ) | |||||
| Set ( LIBHELLOWORLD_VERSION_BUILD 0 ) | |||||
| Set ( LIBHELLOWORLD_VERSION_SHORT "${LIBHELLOWORLD_VERSION_MAJOR}.${LIBHELLOWORLD_VERSION_MINOR}" ) | |||||
| Set ( LIBHELLOWORLD_VERSION "${LIBHELLOWORLD_VERSION_SHORT}.${LIBHELLOWORLD_VERSION_PATCH}.${LIBHELLOWORLD_VERSION_BUILD}" ) | |||||
| Set ( LIBHELLOWORLD_NAME "libhelloworld-${LIBHELLOWORLD_VERSION_SHORT}" ) | |||||
| Set ( LIBHELLOWORLD_OUTPUTNAME "helloworld" ) | |||||
| # Install directories | |||||
| Set ( LIBHELLOWORLD_INSTALL_DIR_INCLUDE "include/${LIBHELLOWORLD_NAME}" ) | |||||
| Set ( LIBHELLOWORLD_INSTALL_DIR_LIB "lib" ) | |||||
| Set ( LIBHELLOWORLD_INSTALL_DIR_SHARE "share/${LIBHELLOWORLD_NAME}" ) | |||||
| # C Standard | |||||
| Set ( CMAKE_C_STANDARD 11 ) | |||||
| Set ( CMAKE_CXX_STANDARD 17 ) | |||||
| Set ( CMAKE_C_STANDARD_REQUIRED ON ) | |||||
| Set ( CMAKE_CXX_STANDARD_REQUIRED ON ) | |||||
| @@ -47,7 +47,8 @@ Message ( WARNING "Please configure the output name of the s | |||||
| Add_Library ( libhelloworld-static STATIC $<TARGET_OBJECTS:libhelloworld-objects> ) | Add_Library ( libhelloworld-static STATIC $<TARGET_OBJECTS:libhelloworld-objects> ) | ||||
| Set_Target_Properties ( libhelloworld-static | Set_Target_Properties ( libhelloworld-static | ||||
| PROPERTIES | PROPERTIES | ||||
| OUTPUT_NAME "helloworld" ) | |||||
| OUTPUT_NAME "helloworld" | |||||
| VERSION ${LIBHELLOWORLD_VERSION} ) | |||||
| Target_Include_Directories ( libhelloworld-static | Target_Include_Directories ( libhelloworld-static | ||||
| PUBLIC | PUBLIC | ||||
| $<BUILD_INTERFACE:${LIBHELLOWORLD_INCLUDE_DIR}> | $<BUILD_INTERFACE:${LIBHELLOWORLD_INCLUDE_DIR}> | ||||
| @@ -59,7 +60,9 @@ Message ( WARNING "Please configure the output name of the s | |||||
| Add_Library ( libhelloworld-shared SHARED $<TARGET_OBJECTS:libhelloworld-objects> ) | Add_Library ( libhelloworld-shared SHARED $<TARGET_OBJECTS:libhelloworld-objects> ) | ||||
| Set_Target_Properties ( libhelloworld-shared | Set_Target_Properties ( libhelloworld-shared | ||||
| PROPERTIES | PROPERTIES | ||||
| OUTPUT_NAME "helloworld" ) | |||||
| OUTPUT_NAME "helloworld" | |||||
| VERSION ${LIBHELLOWORLD_VERSION} | |||||
| SOVERSION ${LIBHELLOWORLD_VERSION_SHORT} ) | |||||
| Target_Include_Directories ( libhelloworld-shared | Target_Include_Directories ( libhelloworld-shared | ||||
| PUBLIC | PUBLIC | ||||
| $<BUILD_INTERFACE:${LIBHELLOWORLD_INCLUDE_DIR}> | $<BUILD_INTERFACE:${LIBHELLOWORLD_INCLUDE_DIR}> | ||||
| @@ -221,7 +221,8 @@ while [ $# -gt 0 ]; do | |||||
| if [ $# -lt 2 ]; then | if [ $# -lt 2 ]; then | ||||
| Panic "Parameter $1 expects exactly one parameter!" | Panic "Parameter $1 expects exactly one parameter!" | ||||
| fi | fi | ||||
| Operations+=("grp:$2") | |||||
| tmp=$(readlink -f "$2") | |||||
| Operations+=("grp:$tmp") | |||||
| shift | shift | ||||
| ;; | ;; | ||||
| @@ -229,7 +230,8 @@ while [ $# -gt 0 ]; do | |||||
| if [ $# -lt 3 ]; then | if [ $# -lt 3 ]; then | ||||
| Panic "Parameter $1 expects exactly two parameter!" | Panic "Parameter $1 expects exactly two parameter!" | ||||
| fi | fi | ||||
| Operations+=("lib:$2:$3") | |||||
| tmp=$(readlink -f "$3") | |||||
| Operations+=("lib:$2:$tmp") | |||||
| shift | shift | ||||
| shift | shift | ||||
| ;; | ;; | ||||
| @@ -238,7 +240,8 @@ while [ $# -gt 0 ]; do | |||||
| if [ $# -lt 3 ]; then | if [ $# -lt 3 ]; then | ||||
| Panic "Parameter $1 expects exactly two parameter!" | Panic "Parameter $1 expects exactly two parameter!" | ||||
| fi | fi | ||||
| Operations+=("exe:$2:$3") | |||||
| tmp=$(readlink -f "$3") | |||||
| Operations+=("exe:$2:$tmp") | |||||
| shift | shift | ||||
| shift | shift | ||||
| ;; | ;; | ||||