forked from agenium-scale/boost.simd
-
Notifications
You must be signed in to change notification settings - Fork 2
/
ns.cmake.install.cmake
72 lines (60 loc) · 2.45 KB
/
ns.cmake.install.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
##==================================================================================================
## Copyright 2016 NumScale SAS
##
## Distributed under the Boost Software License, Version 1.0.
## See accompanying file LICENSE.txt or copy at
## http://www.boost.org/LICENSE_1_0.txt
##==================================================================================================
include(ExternalProject)
if (NOT NS_CMAKE_INSTALL_DIR)
set(NS_CMAKE_INSTALL_DIR ${PROJECT_SOURCE_DIR})
endif()
if (NOT NS_CMAKE_EXTERNAL_PROJECTS_WORKSPACE)
set(NS_CMAKE_EXTERNAL_PROJECTS_WORKSPACE ${PROJECT_BINARY_DIR}/_deps)
endif()
if (NOT NS_CMAKE_GIT_TAG)
set(NS_CMAKE_GIT_TAG master)
endif()
set(_PROJECT_NAME NS_CMAKE)
set(_PROJECT_DIR ${NS_CMAKE_INSTALL_DIR})
set(_PROJECT_WORKSPACE_DIR ${NS_CMAKE_EXTERNAL_PROJECTS_WORKSPACE}/_${_PROJECT_NAME})
set(_PROJECT_SOURCE_DIR ${_PROJECT_WORKSPACE_DIR}/${_PROJECT_NAME})
set(_PROJECT_BUILD_DIR ${_PROJECT_WORKSPACE_DIR}/_build)
ExternalProject_Add(
# The project name
${_PROJECT_NAME}
# Git infos
GIT_REPOSITORY https://github.com/NumScale/ns.cmake.git
GIT_TAG ${NS_CMAKE_GIT_TAG}
# Where all the temporary stuffs will be located
PREFIX ${_PROJECT_WORKSPACE_DIR}
SOURCE_DIR ${_PROJECT_SOURCE_DIR}
BINARY_DIR ${_PROJECT_BUILD_DIR}
DOWNLOAD_DIR ${_PROJECT_BUILD_DIR}/_dl
TMP_DIR ${_PROJECT_BUILD_DIR}/_tmp
STAMP_DIR ${_PROJECT_BUILD_DIR}/_stamp
# Install (we DO need to add the CMAKE_INSTALL_PREFIX...)
INSTALL_DIR ${_PROJECT_DIR}
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${_PROJECT_DIR}"
# Steps to generate
STEP_TARGETS install
)
if (EXISTS ${NS_CMAKE_INSTALL_DIR}/cmake/ns/ns.cmake)
message(STATUS "## -----------------------------------------------------------------------------")
message("")
message(" ns.cmake is now installed!")
message(" ns.cmake's (init) targets have been excluded from the `all` target!")
message("")
message(STATUS "## -----------------------------------------------------------------------------")
set_target_properties(NS_CMAKE
PROPERTIES EXCLUDE_FROM_ALL TRUE
)
set(NS_CMAKE_INSTALLED TRUE)
else()
message(WARNING "You intended to use ns.cmake, but it has not been installed yet!")
add_custom_command(
TARGET NS_CMAKE
COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}
)
set(NS_CMAKE_INSTALLED FALSE)
endif()