/[zanavi_public1]/navit/cmake/navit_macros.cmake
ZANavi

Contents of /navit/cmake/navit_macros.cmake

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Fri Oct 28 21:19:04 2011 UTC (8 years, 9 months ago) by zoff99
File size: 2533 byte(s)
import files
1 macro(internal_set VARIABLE REASON)
2 if (NOT DEFINED ${VARIABLE})
3 set(${VARIABLE} ${ARGN})
4 set(${VARIABLE}_REASON ${REASON} CACHE STRING "reason")
5 else()
6 set(${VARIABLE}_REASON "User defined" CACHE STRING "reason")
7 endif()
8 endmacro()
9
10 macro(set_with_reason VARIABLE REASON ENABLE)
11 if (DEFINED ${VARIABLE}_REASON AND NOT ${VARIABLE}_REASON STREQUAL "User defined")
12 set(${VARIABLE} ${ENABLE})
13 set(${VARIABLE}_REASON ${REASON})
14 string(REPLACE "/" "_" VARIABLE_NAMES ${VARIABLE})
15 set(${VARIABLE_NAMES}_LIBS ${ARGN})
16 else()
17 message("Do not change user defined settings for ${VARIABLE}")
18 endif()
19 endmacro()
20
21 macro(add_feature FEATURE REASON ENABLE)
22 list(APPEND ALL_FEATURES ${FEATURE})
23 internal_set(${FEATURE} ${REASON} ${ENABLE})
24 endmacro()
25
26 macro(cfg_feature FEATURE REASON ENABLE)
27 set(${FEATURE} ${ENABLE})
28 set(${FEATURE}_REASON ${REASON})
29 endmacro()
30
31 macro(add_module MODULE_PATH REASON ENABLE)
32 list(APPEND ALL_MODULES ${MODULE_PATH})
33 internal_set(${MODULE_PATH} ${REASON} ${ENABLE})
34 endmacro()
35
36 # plugins are always linked static
37 macro(add_plugin PLUGIN_PATH REASON ENABLE)
38 list(APPEND ALL_PLUGINS ${PLUGIN_PATH})
39 internal_set(${PLUGIN_PATH} ${REASON} ${ENABLE})
40 endmacro()
41
42 macro(module_add_library MODULE_NAME )
43 add_library(${MODULE_NAME} ${MODULE_BUILD_TYPE} ${ARGN})
44 SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES COMPILE_DEFINITIONS "MODULE=${MODULE_NAME}")
45 TARGET_LINK_LIBRARIES(${MODULE_NAME} ${${MODULE_NAME}_LIBS})
46 SET_TARGET_PROPERTIES( ${MODULE_NAME} PROPERTIES COMPILE_FLAGS "${NAVIT_COMPILE_FLAGS}")
47
48 if (USE_PLUGINS)
49 if (ANDROID)
50 TARGET_LINK_LIBRARIES(${MODULE_NAME} ${NAVIT_LIBNAME})
51 endif()
52 # workaround to be compatible with old paths
53 set_target_properties( ${MODULE_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.libs")
54
55 install(TARGETS ${MODULE_NAME}
56 DESTINATION ${LIB_DIR}/navit/${${MODULE_NAME}_TYPE}
57 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
58 endif()
59 endmacro(module_add_library)
60
61 macro(supportlib_add_library LIB_NAME )
62 add_library(${LIB_NAME} ${ARGN})
63 TARGET_LINK_LIBRARIES(${LIB_NAME} ${${LIB_NAME}_LIBS})
64 SET_TARGET_PROPERTIES( ${LIB_NAME} PROPERTIES COMPILE_FLAGS "${NAVIT_COMPILE_FLAGS}")
65 endmacro(supportlib_add_library)
66
67 macro(message_error)
68 set(NAVIT_DEPENDENCY_ERROR 1)
69 message( SEND_ERROR ${ARGN})
70 endmacro(message_error)

   
Visit the ZANavi Wiki