comparison Framework/Orthanc/Resources/CMake/AutoGeneratedCode.cmake @ 1:2dbe613f6c93

add orthanc core
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Oct 2016 15:39:01 +0200
parents
children
comparison
equal deleted inserted replaced
0:351ab0da0150 1:2dbe613f6c93
1 set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
2 set(AUTOGENERATED_SOURCES)
3
4 file(MAKE_DIRECTORY ${AUTOGENERATED_DIR})
5 include_directories(${AUTOGENERATED_DIR})
6
7 macro(EmbedResources)
8 # Convert a semicolon separated list to a whitespace separated string
9 set(SCRIPT_OPTIONS)
10 set(SCRIPT_ARGUMENTS)
11 set(DEPENDENCIES)
12 set(IS_PATH_NAME false)
13
14 # Loop over the arguments of the function
15 foreach(arg ${ARGN})
16 # Extract the first character of the argument
17 string(SUBSTRING "${arg}" 0 1 FIRST_CHAR)
18 if (${FIRST_CHAR} STREQUAL "-")
19 # If the argument starts with a dash "-", this is an option to
20 # EmbedResources.py
21 list(APPEND SCRIPT_OPTIONS ${arg})
22 else()
23 if (${IS_PATH_NAME})
24 list(APPEND SCRIPT_ARGUMENTS "${arg}")
25 list(APPEND DEPENDENCIES "${arg}")
26 set(IS_PATH_NAME false)
27 else()
28 list(APPEND SCRIPT_ARGUMENTS "${arg}")
29 set(IS_PATH_NAME true)
30 endif()
31 endif()
32 endforeach()
33
34 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
35 add_custom_command(
36 OUTPUT
37 "${TARGET_BASE}.h"
38 "${TARGET_BASE}.cpp"
39 COMMAND
40 ${PYTHON_EXECUTABLE}
41 "${ORTHANC_ROOT}/Resources/EmbedResources.py"
42 ${SCRIPT_OPTIONS}
43 "${AUTOGENERATED_DIR}/EmbeddedResources"
44 ${SCRIPT_ARGUMENTS}
45 DEPENDS
46 "${ORTHANC_ROOT}/Resources/EmbedResources.py"
47 ${DEPENDENCIES}
48 )
49
50 list(APPEND AUTOGENERATED_SOURCES
51 "${AUTOGENERATED_DIR}/EmbeddedResources.cpp"
52 )
53 endmacro()