From 1ccdeb79337c47d8a6c45ef33e904ecd27b01845 Mon Sep 17 00:00:00 2001 From: fherrero <fherrero@iri.upc.edu> Date: Tue, 12 May 2020 16:55:45 +0200 Subject: [PATCH] Add PACKAGE_NAME variable to CMakeLists template, which gets the value of project name substituting underscores by dashes. Variable used for packaging. --- CMakeLists_template.txt | 1 + new_project.sh | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists_template.txt b/CMakeLists_template.txt index 4e84928..531bfed 100755 --- a/CMakeLists_template.txt +++ b/CMakeLists_template.txt @@ -9,6 +9,7 @@ endif(COMMAND cmake_policy) # The project name and the type of project PROJECT(project_name) +SET(PACKAGE_NAME project-name) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin) SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib) diff --git a/new_project.sh b/new_project.sh index dfba67b..23dedf5 100755 --- a/new_project.sh +++ b/new_project.sh @@ -162,12 +162,15 @@ rm ReadMe_template.md #Set the project name on the CMakeLists.txt script file #NEW_NAME=$(echo $NAME | sed 's/_/-/g') NEW_NAME=$NAME +NEW_NAME_WITH_DASHES=$(echo $NAME | sed 's/_/-/g') if [ $TEST = 1 ] then sed 's/project_name/'$NEW_NAME'/g' <CMakeLists_test_template.txt >./CMakeLists.txt else - sed 's/project_name/'$NEW_NAME'/g' <CMakeLists_template.txt >./CMakeLists.txt + sed 's/project_name/'$NEW_NAME'/g' <CMakeLists_template.txt >./temp1.txt + sed 's/project-name/'$NEW_NAME_WITH_DASHES'/g' <temp1.txt >./CMakeLists.txt fi +rm temp1.txt rm CMakeLists_test_template.txt rm CMakeLists_template.txt -- GitLab