Mercurial > hg > orthanc
comparison Resources/CMake/AutoGeneratedCode.cmake @ 4030:100fbe970762
DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Jun 2020 20:50:20 +0200 |
parents | bf9b8bfea0e7 |
children | 78ee0155ec67 |
comparison
equal
deleted
inserted
replaced
4029:156fece692e3 | 4030:100fbe970762 |
---|---|
9 set(SCRIPT_OPTIONS) | 9 set(SCRIPT_OPTIONS) |
10 set(SCRIPT_ARGUMENTS) | 10 set(SCRIPT_ARGUMENTS) |
11 set(DEPENDENCIES) | 11 set(DEPENDENCIES) |
12 set(IS_PATH_NAME false) | 12 set(IS_PATH_NAME false) |
13 | 13 |
14 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources") | |
15 | |
14 # Loop over the arguments of the function | 16 # Loop over the arguments of the function |
15 foreach(arg ${ARGN}) | 17 foreach(arg ${ARGN}) |
16 # Extract the first character of the argument | 18 # Extract the first character of the argument |
17 string(SUBSTRING "${arg}" 0 1 FIRST_CHAR) | 19 string(SUBSTRING "${arg}" 0 1 FIRST_CHAR) |
18 if (${FIRST_CHAR} STREQUAL "-") | 20 if (${FIRST_CHAR} STREQUAL "-") |
19 # If the argument starts with a dash "-", this is an option to | 21 # If the argument starts with a dash "-", this is an option to |
20 # EmbedResources.py | 22 # EmbedResources.py |
21 list(APPEND SCRIPT_OPTIONS ${arg}) | 23 if (${arg} MATCHES "--target=.*") |
24 # Does the argument starts with "--target="? | |
25 string(SUBSTRING "${arg}" 9 -1 TARGET) # 9 is the length of "--target=" | |
26 set(TARGET_BASE "${AUTOGENERATED_DIR}/${TARGET}") | |
27 else() | |
28 list(APPEND SCRIPT_OPTIONS ${arg}) | |
29 endif() | |
22 else() | 30 else() |
23 if (${IS_PATH_NAME}) | 31 if (${IS_PATH_NAME}) |
24 list(APPEND SCRIPT_ARGUMENTS "${arg}") | 32 list(APPEND SCRIPT_ARGUMENTS "${arg}") |
25 list(APPEND DEPENDENCIES "${arg}") | 33 list(APPEND DEPENDENCIES "${arg}") |
26 set(IS_PATH_NAME false) | 34 set(IS_PATH_NAME false) |
29 set(IS_PATH_NAME true) | 37 set(IS_PATH_NAME true) |
30 endif() | 38 endif() |
31 endif() | 39 endif() |
32 endforeach() | 40 endforeach() |
33 | 41 |
34 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources") | |
35 add_custom_command( | 42 add_custom_command( |
36 OUTPUT | 43 OUTPUT |
37 "${TARGET_BASE}.h" | 44 "${TARGET_BASE}.h" |
38 "${TARGET_BASE}.cpp" | 45 "${TARGET_BASE}.cpp" |
39 COMMAND | 46 COMMAND |
40 ${PYTHON_EXECUTABLE} | 47 ${PYTHON_EXECUTABLE} |
41 "${ORTHANC_ROOT}/Resources/EmbedResources.py" | 48 "${ORTHANC_ROOT}/Resources/EmbedResources.py" |
42 ${SCRIPT_OPTIONS} | 49 ${SCRIPT_OPTIONS} |
43 "${AUTOGENERATED_DIR}/EmbeddedResources" | 50 "${TARGET_BASE}" |
44 ${SCRIPT_ARGUMENTS} | 51 ${SCRIPT_ARGUMENTS} |
45 DEPENDS | 52 DEPENDS |
46 "${ORTHANC_ROOT}/Resources/EmbedResources.py" | 53 "${ORTHANC_ROOT}/Resources/EmbedResources.py" |
47 ${DEPENDENCIES} | 54 ${DEPENDENCIES} |
48 ) | 55 ) |
49 | 56 |
50 list(APPEND AUTOGENERATED_SOURCES | 57 list(APPEND AUTOGENERATED_SOURCES |
51 "${AUTOGENERATED_DIR}/EmbeddedResources.cpp" | 58 "${TARGET_BASE}.cpp" |
52 ) | 59 ) |
53 endmacro() | 60 endmacro() |