* Improved tool (git handling)master
| @@ -20,7 +20,8 @@ EndIf ( ) | |||
| # Project ######################################################################################### | |||
| Include ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/helloworld-var.cmake" ) | |||
| Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/helloworld-var.cmake ) | |||
| Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/helloworld-options.cmake ) | |||
| Project ( helloworld | |||
| DESCRIPTION "A simple library" | |||
| VERSION "${HELLOWORLD_VERSION}" ) | |||
| @@ -0,0 +1,6 @@ | |||
| Option ( HELLOWORLD_INSTALL_DEBUG | |||
| "Install the stripped debug informations of helloworld." | |||
| OFF ) | |||
| Option ( HELLOWORLD_NO_STRIP | |||
| "Do not strip debug symbols from binary." | |||
| OFF ) | |||
| @@ -4,13 +4,6 @@ Include ( cotire OPTIONAL RESULT_VARIABLE HAS_COTIRE | |||
| Include ( pedantic OPTIONAL RESULT_VARIABLE HAS_PEDANTIC ) | |||
| Include ( strip_symbols OPTIONAL RESULT_VARIABLE HAS_STRIP_SYMBOLS ) | |||
| Option ( HELLOWORLD_INSTALL_DEBUG | |||
| "Install the stripped debug informations of helloworld." | |||
| OFF ) | |||
| Option ( HELLOWORLD_NO_STRIP | |||
| "Do not strip debug symbols from binary." | |||
| OFF ) | |||
| Message ( WARNING "Please configure the dependencies of this project!" ) | |||
| Find_Package ( libhelloworld REQUIRED ) | |||
| @@ -20,7 +20,8 @@ EndIf ( ) | |||
| # Project ######################################################################################### | |||
| Include ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/libhelloworld-var.cmake" ) | |||
| Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libhelloworld-var.cmake ) | |||
| Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libhelloworld-options.cmake ) | |||
| Project ( libhelloworld | |||
| DESCRIPTION "A simple library" | |||
| VERSION "${LIBHELLOWORLD_VERSION}" ) | |||
| @@ -0,0 +1,15 @@ | |||
| Option ( LIBHELLOWORLD_INSTALL_HEADER | |||
| "Install headers of libhelloworld." | |||
| ON ) | |||
| Option ( LIBHELLOWORLD_INSTALL_STATIC | |||
| "Install static library of libhelloworld." | |||
| ON ) | |||
| Option ( LIBHELLOWORLD_INSTALL_SHARED | |||
| "Install shared library of libhelloworld." | |||
| ON ) | |||
| Option ( LIBHELLOWORLD_INSTALL_DEBUG | |||
| "Install the stripped debug informations of libhelloworld." | |||
| OFF ) | |||
| Option ( LIBHELLOWORLD_NO_STRIP | |||
| "Do not strip debug symbols from binary." | |||
| OFF ) | |||
| @@ -4,22 +4,6 @@ Include ( cotire OPTIONAL RESULT_VARIABLE HAS_COTIRE | |||
| Include ( pedantic OPTIONAL RESULT_VARIABLE HAS_PEDANTIC ) | |||
| Include ( strip_symbols OPTIONAL RESULT_VARIABLE HAS_STRIP_SYMBOLS ) | |||
| Option ( LIBHELLOWORLD_INSTALL_HEADER | |||
| "Install headers of libhelloworld." | |||
| ON ) | |||
| Option ( LIBHELLOWORLD_INSTALL_STATIC | |||
| "Install static library of libhelloworld." | |||
| ON ) | |||
| Option ( LIBHELLOWORLD_INSTALL_SHARED | |||
| "Install shared library of libhelloworld." | |||
| ON ) | |||
| Option ( LIBHELLOWORLD_INSTALL_DEBUG | |||
| "Install the stripped debug informations of libhelloworld." | |||
| OFF ) | |||
| Option ( LIBHELLOWORLD_NO_STRIP | |||
| "Do not strip debug symbols from binary." | |||
| OFF ) | |||
| # Object Library ################################################################################## | |||
| Set ( CMAKE_POSITION_INDEPENDENT_CODE ON ) | |||
| @@ -6,6 +6,7 @@ ScriptDir=$(dirname "${ScriptFile}") | |||
| UseGit=1 | |||
| Verbose=0 | |||
| CMakeModules="" | |||
| CMakeModulesForced="" | |||
| Operations=() | |||
| function Log() | |||
| @@ -27,7 +28,7 @@ function Error() | |||
| function Panic() | |||
| { | |||
| Error $@ | |||
| Error "$@" | |||
| exit 1 | |||
| } | |||
| @@ -47,7 +48,8 @@ Parameters: | |||
| Create a new executable project with the given name at the given directory. | |||
| -m|--modules <remote> | |||
| Add the CMake Modules fromthe given remote repository as submodule of the new project. | |||
| -M|--force-modules <remote> | |||
| Add the CMake Modules from the given remote repository as submodule of the new project. | |||
| -n|--nogit | |||
| Does not initialize a new git repository when creating a new project group. | |||
| @@ -110,7 +112,7 @@ function CreateGroup() | |||
| # Add cmake modules | |||
| Log " Add git submodule for CMake modules" | |||
| if [[ -n "$CMakeModules" ]]; then | |||
| git -C $dir submodule add "$CMakeModules" "$dir/cmake/modules" \ | |||
| git -C $dir submodule add $CMakeModulesForced "$CMakeModules" "$dir/cmake/modules" \ | |||
| || Panic "Git submodule add failed!" | |||
| fi | |||
| fi | |||
| @@ -151,10 +153,18 @@ function CreateLibrary() | |||
| mkdir -p "$dir" \ | |||
| || Panic "Unable to create directory: $dir!" | |||
| # Add cmake modules | |||
| if [[ $UseGit -eq 1 ]] && [[ -n "$CMakeModules" ]]; then | |||
| git -C $dir submodule add "$CMakeModules" "$dir/cmake/modules" \ | |||
| || Panic "Git submodule add failed!" | |||
| # Create git repository | |||
| Log " Create git repository" | |||
| if [[ $UseGit -eq 1 ]]; then | |||
| git -C $dir init \ | |||
| || Panic "Git init failed!" | |||
| # Add cmake modules | |||
| Log " Add git submodule for CMake modules" | |||
| if [[ -n "$CMakeModules" ]]; then | |||
| git -C $dir submodule add $CMakeModulesForced "$CMakeModules" "$dir/cmake/modules" \ | |||
| || Panic "Git submodule add failed!" | |||
| fi | |||
| fi | |||
| # Copy files | |||
| @@ -188,10 +198,18 @@ function CreateExecutable() | |||
| mkdir -p "$dir" \ | |||
| || Panic "Unable to create directory: $dir!" | |||
| # Add cmake modules | |||
| if [[ $UseGit -eq 1 ]] && [[ -n "$CMakeModules" ]]; then | |||
| git -C $dir submodule add "$CMakeModules" "$dir/cmake/modules" \ | |||
| || Panic "Git submodule add failed!" | |||
| # Create git repository | |||
| Log " Create git repository" | |||
| if [[ $UseGit -eq 1 ]]; then | |||
| git -C $dir init \ | |||
| || Panic "Git init failed!" | |||
| # Add cmake modules | |||
| Log " Add git submodule for CMake modules" | |||
| if [[ -n "$CMakeModules" ]]; then | |||
| git -C $dir submodule add $CMakeModulesForced "$CMakeModules" "$dir/cmake/modules" \ | |||
| || Panic "Git submodule add failed!" | |||
| fi | |||
| fi | |||
| # Copy files | |||
| @@ -254,6 +272,15 @@ while [ $# -gt 0 ]; do | |||
| shift | |||
| ;; | |||
| "-M" | "--force-modules" ) | |||
| if [ $# -lt 2 ]; then | |||
| Panic "Parameter $1 expects exactly one parameter!" | |||
| fi | |||
| CMakeModules="$2" | |||
| CMakeModulesForced="--force" | |||
| shift | |||
| ;; | |||
| "-n" | "--nogit" ) | |||
| UseGit=0 | |||
| ;; | |||