forked from ament/uncrustify_vendor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (56 loc) · 2.02 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.5)
project(uncrustify_vendor)
find_package(ament_cmake REQUIRED)
macro(build_uncrustify)
set(extra_cmake_args)
if(DEFINED CMAKE_BUILD_TYPE)
list(APPEND extra_cmake_args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
if(DEFINED CMAKE_TOOLCHAIN_FILE)
list(APPEND extra_cmake_args "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
if(ANDROID)
if(DEFINED ANDROID_ABI)
list(APPEND extra_cmake_args "-DANDROID_ABI=${ANDROID_ABI}")
endif()
if(DEFINED ANDROID_CPP_FEATURES)
list(APPEND extra_cmake_args "-DANDROID_CPP_FEATURES=${ANDROID_CPP_FEATURES}")
endif()
if(DEFINED ANDROID_FUNCTION_LEVEL_LINKING)
list(APPEND extra_cmake_args "-DANDROID_FUNCTION_LEVEL_LINKING=${ANDROID_FUNCTION_LEVEL_LINKING}")
endif()
if(DEFINED ANDROID_NATIVE_API_LEVEL)
list(APPEND extra_cmake_args "-DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL}")
endif()
if(DEFINED ANDROID_NDK)
list(APPEND extra_cmake_args "-DANDROID_NDK=${ANDROID_NDK}")
endif()
if(DEFINED ANDROID_STL)
list(APPEND extra_cmake_args "-DANDROID_STL=${ANDROID_STL}")
endif()
if(DEFINED ANDROID_TOOLCHAIN_NAME)
list(APPEND extra_cmake_args "-DANDROID_TOOLCHAIN_NAME=${ANDROID_TOOLCHAIN_NAME}")
endif()
endif()
endif()
include(ExternalProject)
ExternalProject_Add(uncrustify
GIT_REPOSITORY https://github.com/uncrustify/uncrustify.git
GIT_REMOTE_NAME origin
GIT_TAG origin/master
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_install
${extra_cmake_args}
-Wno-dev
)
# The external project will install to the build folder, but we'll install that on make install.
install(
DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_install/
DESTINATION
${CMAKE_INSTALL_PREFIX}
USE_SOURCE_PERMISSIONS
)
endmacro()
build_uncrustify()
# this ensures that the package has an environment hook setting the PATH
ament_package()