comparison Resources/CMake/AutoGeneratedCode.cmake @ 0:02f7a0400a91

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Feb 2015 13:45:35 +0100
parents
children b1eafe1e8511
comparison
equal deleted inserted replaced
-1:000000000000 0:02f7a0400a91
1 # Orthanc - A Lightweight, RESTful DICOM Store
2 # Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
3 # Department, University Hospital of Liege, Belgium
4 #
5 # This program is free software: you can redistribute it and/or
6 # modify it under the terms of the GNU Affero General Public License
7 # as published by the Free Software Foundation, either version 3 of
8 # the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Affero General Public License for more details.
14 #
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19 set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
20 set(AUTOGENERATED_SOURCES)
21
22 file(MAKE_DIRECTORY ${AUTOGENERATED_DIR})
23 include_directories(${AUTOGENERATED_DIR})
24
25 macro(EmbedResources)
26 # Convert a semicolon separated list to a whitespace separated string
27 set(SCRIPT_ARGUMENTS)
28 set(DEPENDENCIES)
29 set(IS_PATH_NAME false)
30 foreach(arg ${ARGN})
31 if (${IS_PATH_NAME})
32 list(APPEND SCRIPT_ARGUMENTS "${arg}")
33 list(APPEND DEPENDENCIES "${arg}")
34 set(IS_PATH_NAME false)
35 else()
36 list(APPEND SCRIPT_ARGUMENTS "${arg}")
37 set(IS_PATH_NAME true)
38 endif()
39 endforeach()
40
41 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
42 add_custom_command(
43 OUTPUT
44 "${TARGET_BASE}.h"
45 "${TARGET_BASE}.cpp"
46 COMMAND
47 python
48 "${CMAKE_CURRENT_SOURCE_DIR}/Resources/EmbedResources.py"
49 "${AUTOGENERATED_DIR}/EmbeddedResources"
50 ${SCRIPT_ARGUMENTS}
51 DEPENDS
52 "${CMAKE_CURRENT_SOURCE_DIR}/Resources/EmbedResources.py"
53 ${DEPENDENCIES}
54 )
55
56 list(APPEND AUTOGENERATED_SOURCES
57 "${AUTOGENERATED_DIR}/EmbeddedResources.cpp"
58 )
59 endmacro()