author | koda |
Thu, 13 Jun 2013 22:27:23 +0200 | |
changeset 9224 | bce8cf41d666 |
parent 9220 | 5e7db24f3489 |
parent 8794 | 9f47c1f8056d |
child 9225 | d8d929f92633 |
permissions | -rw-r--r-- |
8686
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
1 |
|
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
2 |
macro(find_package_or_fail _PKG_NAME) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
3 |
find_package(${_PKG_NAME}) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
4 |
string(TOUPPER ${_PKG_NAME} _PKG_NAME_UP) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
5 |
if(NOT ${_PKG_NAME_UP}_FOUND) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
6 |
message(SEND_ERROR "Missing ${_PKG_NAME}! Please install it and rerun cmake.") |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
7 |
endif(NOT ${_PKG_NAME_UP}_FOUND) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
8 |
endmacro(find_package_or_fail _PKG_NAME) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
9 |
|
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
10 |
macro(find_package_or_disable _PKG_NAME _VAR_NAME) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
11 |
find_package(${_PKG_NAME}) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
12 |
string(TOUPPER ${_PKG_NAME} _PKG_NAME_UP) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
13 |
if(NOT ${_PKG_NAME_UP}_FOUND) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
14 |
message(SEND_ERROR "Missing ${_PKG_NAME}! Rerun cmake with -D${_VAR_NAME}=1 to build without it.") |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
15 |
endif(NOT ${_PKG_NAME_UP}_FOUND) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
16 |
endmacro(find_package_or_disable _PKG_NAME _VAR_NAME) |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
17 |
|
8688 | 18 |
macro(find_package_or_disable_msg _PKG_NAME _VAR_NAME _MSG) |
19 |
if(NOT ${_VAR_NAME}) |
|
20 |
find_package_or_disable(${_PKG_NAME} ${_VAR_NAME}) |
|
21 |
else(NOT ${_VAR_NAME}) |
|
22 |
message(STATUS "${_PKG_NAME} disabled. ${_MSG}") |
|
23 |
string(TOUPPER ${_PKG_NAME} _PKG_NAME_UP) |
|
24 |
set(${_PKG_NAME_UP}_FOUND false) |
|
25 |
endif(NOT ${_VAR_NAME}) |
|
26 |
endmacro(find_package_or_disable_msg _PKG_NAME _VAR_NAME _MSG) |
|
27 |
||
9220 | 28 |
macro(append_linker_flag _FLAG) |
29 |
list(APPEND pascal_flags "-k${_FLAG}") |
|
30 |
list(APPEND haskell_flags "-optl" "${_FLAG}") |
|
31 |
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,${_FLAG}") |
|
32 |
set(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -Wl,${_FLAG}") |
|
33 |
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -Wl,${_FLAG}") |
|
34 |
endmacro(append_linker_flag _FLAG) |
|
8688 | 35 |
|
8686
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
36 |
#TODO: find_package_or_bundle |
d303da4568b7
introduce find_package_or_fail/disable to group together similar cmake code
koda
parents:
diff
changeset
|
37 |
|
8772 | 38 |
|
39 |
macro(add_flag_append _VAR_NAME _FLAG) |
|
40 |
set(${_VAR_NAME} "${${_VAR_NAME}} ${_FLAG}") |
|
41 |
endmacro(add_flag_append _VAR_NAME _FLAG) |
|
42 |
||
43 |
macro(add_flag_prepend _VAR_NAME _FLAG) |
|
8794 | 44 |
set(${_VAR_NAME} "${_FLAG} ${${_VAR_NAME}}") |
8772 | 45 |
endmacro(add_flag_prepend _VAR_NAME _FLAG) |
46 |