1 macro(internal_set VARIABLE REASON)
2 if (NOT DEFINED ${VARIABLE})
3 set(${VARIABLE} ${ARGN})
4 set(${VARIABLE}_REASON ${REASON} CACHE STRING "reason")
6 set(${VARIABLE}_REASON "User defined" CACHE STRING "reason")
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})
17 message("Do not change user defined settings for ${VARIABLE}")
21 macro(add_feature FEATURE REASON ENABLE)
22 list(APPEND ALL_FEATURES ${FEATURE})
23 internal_set(${FEATURE} ${REASON} ${ENABLE})
26 macro(cfg_feature FEATURE REASON ENABLE)
27 set(${FEATURE} ${ENABLE})
28 set(${FEATURE}_REASON ${REASON})
31 macro(add_module MODULE_PATH REASON ENABLE)
32 list(APPEND ALL_MODULES ${MODULE_PATH})
33 internal_set(${MODULE_PATH} ${REASON} ${ENABLE})
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})
42 # module plugins are always linked static
43 macro(add_module_plugin PLUGIN_PATH REASON ENABLE)
44 list(APPEND ALL_MODULE_PLUGINS ${PLUGIN_PATH})
45 internal_set(${PLUGIN_PATH} ${REASON} ${ENABLE})
48 macro(module_add_library MODULE_NAME )
49 LINK_DIRECTORIES(${${MODULE_NAME}_LIBRARY_DIRS})
50 add_library(${MODULE_NAME} ${MODULE_BUILD_TYPE} ${ARGN})
51 SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES COMPILE_DEFINITIONS "MODULE=${MODULE_NAME}")
52 TARGET_LINK_LIBRARIES(${MODULE_NAME} ${${MODULE_NAME}_LIBS})
53 SET_TARGET_PROPERTIES( ${MODULE_NAME} PROPERTIES COMPILE_FLAGS "${NAVIT_COMPILE_FLAGS} ${${MODULE_NAME}_FLAGS}")
54 INCLUDE_DIRECTORIES(${${MODULE_NAME}_INCLUDES})
57 TARGET_LINK_LIBRARIES(${MODULE_NAME} ${NAVIT_LIBNAME})
60 set_target_properties( ${MODULE_NAME} PROPERTIES LINK_FLAGS "-Wl,-undefined -Wl,dynamic_lookup")
62 # workaround to be compatible with old paths
63 set_target_properties( ${MODULE_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.libs")
65 install(TARGETS ${MODULE_NAME}
66 DESTINATION ${LIB_DIR}/navit/${${MODULE_NAME}_TYPE}
67 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
69 endmacro(module_add_library)
71 macro(supportlib_add_library LIB_NAME )
72 add_library(${LIB_NAME} ${ARGN})
73 TARGET_LINK_LIBRARIES(${LIB_NAME} ${${LIB_NAME}_LIBS})
74 SET_TARGET_PROPERTIES( ${LIB_NAME} PROPERTIES COMPILE_FLAGS "${NAVIT_COMPILE_FLAGS}")
75 SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES COMPILE_DEFINITIONS "MODULE=${LIB_NAME}")
76 endmacro(supportlib_add_library)
79 set(NAVIT_DEPENDENCY_ERROR 1)
80 message( SEND_ERROR ${ARGN})
81 endmacro(message_error)