Make sure to point to correct dir for cmake script
[staging/xdg-launcher.git] / cmake / cmake.d / 04-extra_targets.cmake
1 ###########################################################################
2 # Copyright 2015, 2016, 2017 IoT.bzh
3 #
4 # author: Fulup Ar Foll <fulup@iot.bzh>
5 # contrib: Romain Forlot <romain.forlot@iot.bzh>
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 ###########################################################################
19
20
21 #--------------------------------------------------------------------------
22 #  WARNING:
23 #     Do not change this cmake template
24 #     Customise your preferences in "./conf.d/cmake/config.cmake"
25 #--------------------------------------------------------------------------
26
27 #Generate a cmake cache file usable by cmake script.
28 set(CacheForScript ${CMAKE_BINARY_DIR}/CMakeCacheForScript.cmake)
29 #Create a tmp cmake file.
30 file(WRITE ${CacheForScript} "")
31
32 get_cmake_property(Vars VARIABLES)
33 foreach(Var ${Vars})
34         if(${Var})
35                 #Replace unwanted char.
36                 string(REPLACE "\\" "\\\\" VALUE ${${Var}})
37                 string(REPLACE "\n" "\\n" VALUE ${VALUE})
38                 string(REPLACE "\r" "\\n" VALUE ${VALUE})
39                 string(REPLACE "\"" "\\\"" VALUE ${VALUE})
40         endif()
41         file(APPEND ${CacheForScript} "set(${Var} \"${VALUE}\")\n")
42 endforeach()
43
44 # ----------------------------------------------------------------------------
45 #                                Autobuild target
46 # ----------------------------------------------------------------------------
47
48 add_custom_target(autobuild ALL DEPENDS ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/template.d/autobuild/agl/autobuild.in
49         ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/template.d/autobuild/linux/autobuild.in
50         COMMAND ${CMAKE_COMMAND} -DINFILE=${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/template.d/autobuild/agl/autobuild.in -DOUTFILE=${PROJECT_TEMPLATE_AGL_AUTOBUILD_DIR}/autobuild -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake
51         COMMAND ${CMAKE_COMMAND} -DINFILE=${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/template.d/autobuild/agl/autobuild.in -DOUTFILE=${PROJECT_TEMPLATE_LINUX_AUTOBUILD_DIR}/autobuild -DPROJECT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}/cmake/configure_file.cmake
52 )