SVN_SILENT made messages (.desktop file) - always resolve ours
[kdepim.git] / SuperBuild.cmake
blob8d51da937df147c58fdc42be0135a39a92496452
1 include(ExternalProject)
2 include(CMakeParseArguments)
5 set(SB_PACKAGE_VERSION_NUMBER "0.0.1" CACHE STRING "The version number for the source package.")
7 set(SB_CMAKE_ARGS "" CACHE STRING "Additional arguments to CMake which will be used for all subprojects (e.g. \"-DFOO=Bar\"). For per-project arguments variables SB_CMAKE_ARGS_<ProjectName> can be defined.")
9 set(SB_SILENT_SKIPPED_PROJECTS FALSE)
11 # this file (SuperBuild.cmake) is systematically included from one of the child directories
12 # where some CMakeLists.txt state include(../SuperBuild.cmake). So the current directory is
13 # located in a subfolder of this include file. That's why global SuperBuildOptions.cmake should
14 # be included from ../ (e.g. the parent directory)
15 #message(STATUS ${CMAKE_CURRENT_SOURCE_DIR})
16 include(../GlobalSuperBuildOptions.cmake OPTIONAL)
18 # this file is included from the project directory and allow for local definitions
19 include(SuperBuildOptions.cmake OPTIONAL)
21 # set up directory structure to use for the ExternalProjects
22 set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
23              PROPERTY EP_BASE ${CMAKE_CURRENT_BINARY_DIR}
24             )
26 if (NOT SB_INSTALL_PREFIX)
27   set(SB_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
28 endif()
30 set(_SB_LAST_TARGET)
32 macro(sb_add_project _subdir )
33   set(name "${_subdir}")
34   if("${_subdir}" MATCHES "(.+)/(.+)")
35     set(name "${CMAKE_MATCH_2}")
36   endif()
38   message(STATUS "superbuild: Adding project ${_subdir}")
40   externalproject_add(sb_${name}
41                       ${_SB_UNPARSED_ARGUMENTS}
42                       DOWNLOAD_COMMAND ""
43                       SOURCE_DIR  ${CMAKE_SOURCE_DIR}/${_subdir}
44                       TMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/SuperBuild/tmpfiles/${name}
45                       STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/SuperBuild/stampfiles/${name}
46                       DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/SuperBuild/download/${name}
47                       BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${name}
48                       INSTALL_DIR ${SB_INSTALL_PREFIX}
49                       CMAKE_ARGS --no-warn-unused-cli
50                                  -DQT_QMAKE_EXECUTABLE=${QT_QMAKE_EXECUTABLE}
51                                  -DCMAKE_PREFIX_PATH=${SB_INITIAL_DESTDIR}${CMAKE_INSTALL_PREFIX}
52                                  -DCMAKE_INSTALL_PREFIX=${SB_INSTALL_PREFIX}
53                                  -DCMAKE_SKIP_RPATH="${CMAKE_SKIP_RPATH}"
54                                  -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
55                                  -DLIB_SUFFIX=${LIB_SUFFIX}
56                                  ${SB_CMAKE_ARGS}
57                                  ${SB_CMAKE_ARGS_${name}}
58                       )
60   set_target_properties(sb_${name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
62   if(_SB_LAST_TARGET)
63     add_dependencies(sb_${name} ${_SB_LAST_TARGET})
64   endif()
65   set(_SB_LAST_TARGET sb_${name})
66 endmacro(sb_add_project)
68 macro(sb_end)
69   add_custom_target(sb_all)
70   set_target_properties(sb_all PROPERTIES EXCLUDE_FROM_ALL TRUE)
71   add_dependencies(sb_all ${_SB_LAST_TARGET})
72 endmacro(sb_end)
74 #file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ThisIsASourcePackage.in "This is a generated source package.")
76 #install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ThisIsASourcePackage.in DESTINATION src RENAME ThisIsASourcePackage.valid  COMPONENT SuperBuild )
77 #install(FILES CMakeLists.txt DESTINATION src  COMPONENT SuperBuild )
78 #install(FILES ${CMAKE_CURRENT_LIST_FILE} DESTINATION .  COMPONENT SuperBuild )
81 set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)