blob: 76e1121f82e27d310553cd2ac923875029dc677b (
plain)
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
73
74
75
|
##############################################################################
# Provide custom install_* macros to account for all files
##############################################################################
include(CMakeParseArguments)
function(INSTALL_HEADERS)
set(options)
set(oneValueArgs COMPONENT)
set(multiValueArgs HEADERS)
cmake_parse_arguments(INSTALL_HEADERS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
FOREACH(HEADER ${INSTALL_HEADERS_HEADERS})
# message(STATUS "ADDING HEADER ${HEADER}")
if (${HEADER} MATCHES "${CMAKE_BINARY_DIR}.*")
STRING(REGEX REPLACE "${CMAKE_BINARY_DIR}/uscxml/" "" REL_HEADER ${HEADER})
STRING(REGEX MATCH "[^/\\](.*)[/\\]" REL_HEADER ${REL_HEADER})
SET(REL_HEADER "uscxml/${REL_HEADER}")
# message(STATUS "MATCHED CMAKE_BINARY_DIR -> ${REL_HEADER}")
elseif(${HEADER} MATCHES "${PROJECT_SOURCE_DIR}.*")
STRING(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/" "" REL_HEADER ${HEADER})
# message(STATUS "MATCHED PROJECT_SOURCE_DIR -> ${REL_HEADER}")
else()
message(STATUS "MATCHED no known prefix: ${HEADER}")
endif()
STRING(REGEX MATCH "(.*)[/\\]" DIR ${REL_HEADER})
# message("ADDING ${HEADER} in include/${DIR} for ${INSTALL_HEADERS_COMPONENT}")
INSTALL(FILES ${HEADER} DESTINATION include/${DIR} COMPONENT ${INSTALL_HEADERS_COMPONENT})
ENDFOREACH()
endfunction()
function(INSTALL_FILES)
set(options)
set(oneValueArgs COMPONENT DESTINATION)
set(multiValueArgs FILES)
cmake_parse_arguments(INSTALL_FILE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
install(FILES ${INSTALL_FILE_FILES} DESTINATION ${INSTALL_FILE_DESTINATION} COMPONENT ${INSTALL_FILE_COMPONENT})
endfunction()
function(INSTALL_LIBRARY)
set(options)
set(oneValueArgs COMPONENT)
set(multiValueArgs TARGETS)
cmake_parse_arguments(INSTALL_LIBRARY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
install(TARGETS ${INSTALL_LIBRARY_TARGETS} DESTINATION lib COMPONENT ${INSTALL_LIBRARY_COMPONENT})
endfunction()
function(INSTALL_EXECUTABLE)
set(options)
set(oneValueArgs COMPONENT)
set(multiValueArgs TARGETS)
cmake_parse_arguments(INSTALL_EXECUTABLE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
install(
TARGETS ${INSTALL_EXECUTABLE_TARGETS}
DESTINATION bin
COMPONENT ${INSTALL_EXECUTABLE_COMPONENT}
PERMISSIONS WORLD_EXECUTE OWNER_EXECUTE GROUP_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
endfunction()
# see http://www.cmake.org/Wiki/CMakeCompareVersionStrings
SET(THREE_PART_VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+")
# Breaks up a string in the form n1.n2.n3 into three parts and stores
# them in major, minor, and patch. version should be a value, not a
# variable, while major, minor and patch should be variables.
MACRO(THREE_PART_VERSION_TO_VARS version major minor patch)
IF(${version} MATCHES ${THREE_PART_VERSION_REGEX})
STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ${major} "${version}")
STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" ${minor} "${version}")
STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ${patch} "${version}")
ELSE(${version} MATCHES ${THREE_PART_VERSION_REGEX})
MESSAGE("MACRO(THREE_PART_VERSION_TO_VARS ${version} ${major} ${minor} ${patch}")
MESSAGE(FATAL_ERROR "Problem parsing version string, I can't parse it properly.")
ENDIF(${version} MATCHES ${THREE_PART_VERSION_REGEX})
ENDMACRO(THREE_PART_VERSION_TO_VARS)
|