Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CTA-LAPP
PHOENIX_LIBS
PhoenixNotify
Commits
e98940f6
Commit
e98940f6
authored
Feb 16, 2021
by
Pierre Aubert
Browse files
Add version generator
parent
5f91a26e
Pipeline
#105060
passed with stages
in 7 minutes and 58 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
cmake/create_version.cmake
cmake/create_version.cmake
+45
-0
cmake/phoenix_base_project.cmake
cmake/phoenix_base_project.cmake
+2
-0
No files found.
cmake/create_version.cmake
0 → 100644
View file @
e98940f6
# Create the version header of the given program
# projectName : name of the project
# projectVersion : version of the project
function
(
create_version projectName projectVersion
)
message
(
STATUS
"Program
${
projectName
}
version
${
projectVersion
}
"
)
string
(
REPLACE
"."
";"
VERSION_STR_LIST
${
projectVersion
}
)
set
(
VERSION_LIST
${
VERSION_STR_LIST
}
)
list
(
LENGTH VERSION_LIST listLength
)
list
(
GET VERSION_LIST 0 MAJOR_PROG_VERSION
)
list
(
GET VERSION_LIST 1 MINOR_PROG_VERSION
)
list
(
GET VERSION_LIST 2 PATCH_PROG_VERSION
)
string
(
TOUPPER
${
projectName
}
PROGRAM_UPPER_NAME
)
string
(
TOLOWER
${
projectName
}
PROGRAM_LOWER_NAME
)
set
(
OUTPUT_FILE
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
PROGRAM_LOWER_NAME
}
_version.h
)
set
(
DEFINE_MACRO_HEADER
"__
${
PROGRAM_UPPER_NAME
}
_VERSION_H__"
)
file
(
WRITE
${
OUTPUT_FILE
}
"
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"/***************************************
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
" Auteur : Pierre Aubert
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
" Mail : aubertp7@gmail.com
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
" Licence : CeCILL-C
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"****************************************/
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"#ifndef
${
DEFINE_MACRO_HEADER
}
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"#define
${
DEFINE_MACRO_HEADER
}
\n\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"#define
${
PROGRAM_UPPER_NAME
}
_VERSION_MAJOR
${
MAJOR_PROG_VERSION
}
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"#define
${
PROGRAM_UPPER_NAME
}
_VERSION_MINOR
${
MINOR_PROG_VERSION
}
\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"#define
${
PROGRAM_UPPER_NAME
}
_VERSION_PATCH
${
PATCH_PROG_VERSION
}
\n\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"#define
${
PROGRAM_UPPER_NAME
}
_MAKE_VERSION(major, minor, patch) ((major) *10000 + (minor) *100 + (patch))
\n\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"#define
${
PROGRAM_UPPER_NAME
}
_VERSION
${
PROGRAM_UPPER_NAME
}
_MAKE_VERSION (
${
PROGRAM_UPPER_NAME
}
_VERSION_MAJOR,
${
PROGRAM_UPPER_NAME
}
_VERSION_MINOR,
${
PROGRAM_UPPER_NAME
}
_VERSION_PATCH)
\n\n
"
)
file
(
APPEND
${
OUTPUT_FILE
}
"#endif
\n\n
"
)
install
(
FILES
${
OUTPUT_FILE
}
DESTINATION include/
${
projectName
}
)
endfunction
(
create_version
)
cmake/phoenix_base_project.cmake
View file @
e98940f6
include
(
create_version.cmake
)
# Define the base of a Phoenix project
# programName : name of the program/library
...
...
@@ -6,6 +7,7 @@
# programDescritpion : description of the program/library
# programHomePage : home page of the program/library
function
(
phoenix_base_project programName programVersion programDescritpion programHomePage
)
create_version
(
"
${
programName
}
"
"
${
programVersion
}
"
)
if
(
NOT MODULE_MODE
)
set
(
PROGRAM_NAME
"
${
programName
}
"
CACHE STRING
"name of the current project"
FORCE
)
set
(
PROGRAM_VERSION
"
${
programVersion
}
"
CACHE STRING
"version of the current project"
FORCE
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment