forked from Eyescale/CMake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Buildyard.cmake
52 lines (44 loc) · 1.56 KB
/
Buildyard.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Bootstrap Buildyard from a project source directory.
#
# Needs CMake/<project>.cmake and CMake/depends.txt, which are generated by
# Buildyard. git add them to your project and then add to the top-level
# CMakeLists.txt:
# project(Foo)
# list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake)
# include(Buildyard)
# if(BUILDYARD_STOP)
# return()
# endif()
# ...
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
if(BUILDYARD)
# Running from within Buildyard, no need for me
return()
endif()
option(BUILDYARD_DISABLED "Disable bootstrapping using Buildyard" OFF)
if(BUILDYARD_DISABLED)
return()
endif()
include(FindRequired)
if(FOUND_REQUIRED)
return()
endif()
message(STATUS "Bootstrap Buildyard for missing${FIND_REQUIRED_FAILED}")
set(BUILDYARD_BOOTSTRAP ON)
include(GitExternal)
git_external("${PROJECT_BINARY_DIR}/Buildyard"
https://github.com/Eyescale/Buildyard.git master)
configure_file("${PROJECT_SOURCE_DIR}/CMake/${PROJECT_NAME}.cmake"
"${PROJECT_BINARY_DIR}/Buildyard/config.Buildyard/${PROJECT_NAME}.cmake"
COPYONLY)
configure_file("${PROJECT_SOURCE_DIR}/CMake/depends.txt"
"${PROJECT_BINARY_DIR}/Buildyard/config.Buildyard/depends.txt" COPYONLY)
set(BUILDYARD_TARGETS ${PROJECT_NAME})
add_subdirectory("${PROJECT_BINARY_DIR}/Buildyard" # source
"${PROJECT_BINARY_DIR}/Buildyard.bin" ) # binary
if(MSVC)
message(STATUS "Build 00_Main->AllProjects to bootstrap and 00_Main->AllBuild after bootstrap\n")
else()
message(STATUS "Use 'make -jN' to bootstrap and 'make -jN AllBuild' after bootstrap\n")
endif()
set(BUILDYARD_STOP TRUE)