1 # Find dependencies ( linux, tizen )
2 IF( ENABLE_PKG_CONFIGURE )
3 FIND_PACKAGE(PkgConfig REQUIRED)
6 # Special constant for ARG_ENABLE function
7 SET( ENABLE_VAL "#ENABLE_VAL" )
9 SET( CUSTOM_ARGUMENTS "" )
11 # Macro checks if the module is available and sets user variable
12 MACRO( CHECK_MODULE_AND_SET PKG_VAR PKG_LIB_REQUIREMENTS VAR_TO_SET )
13 PKG_CHECK_MODULES(${PKG_VAR} "${PKG_LIB_REQUIREMENTS}")
14 IF( ${PKG_VAR}_FOUND )
15 SET( ${VAR_TO_SET} ON )
16 SET( ${VAR_TO_SET}_ENABLED ON )
18 SET( ${VAR_TO_SET}_ENABLED OFF )
22 # Simple ternary operator
23 FUNCTION( TEST_IF CONDITION OUTPUT_VAR VAL0 VAL1 )
25 SET( ${OUTPUT_VAR} ${VAL0} PARENT_SCOPE )
27 SET( ${OUTPUT_VAR} {VAL1} PARENT_SCOPE )
31 # Conditional macro immitates autoconf AM_CONDITIONAL
32 MACRO( CONDITIONAL VARIABLE )
38 MACRO( OPT_STRING NAME DEFAULT_VALUE )
39 SET( ${NAME} ${DEFAULT_VALUE} CACHE STRING "${ARGN}" )
42 FUNCTION( ARG_ENABLE NAME INTERNAL_VAR LIST_OF_VALUES )
43 SET(HELP_ENABLES "${HELP_ENABLES}\n${NAME}\t-\t${ARGN}" PARENT_SCOPE)
44 SET(CUSTOM_ARGUMENTS "${CUSTOM_ARGUMENTS};${NAME}" PARENT_SCOPE)
45 LIST(LENGTH LIST_OF_VALUES SIZE)
46 LIST(GET LIST_OF_VALUES 0 OPT_ON )
48 LIST(GET LIST_OF_VALUES 1 OPT_OFF )
51 SET( ${NAME} "${OPT_OFF}" CACHE STRING "${ARGN}" )
53 SET( ${NAME} "OFF" CACHE STRING "${ARGN}" )
56 IF(OPT_ON MATCHES ENABLE_VAL)
57 SET( ${INTERNAL_VAR} ${${NAME}} PARENT_SCOPE )
59 SET( ${INTERNAL_VAR} ${OPT_ON} PARENT_SCOPE )
63 SET( ${INTERNAL_VAR} ${OPT_OFF} PARENT_SCOPE )
65 IF( CMAKE_MAJOR_VERSION GREATER 3 )
66 UNSET( ${INTERNAL_VAR} PARENT_SCOPE )
68 UNSET( ${INTERNAL_VAR} )
72 MESSAGE( STATUS "${NAME} = ${${NAME}}")
75 # This macro unsets all cached argument variables, should be called
77 MACRO( CLEAN_ARG_CACHE )
78 FOREACH( arg IN LISTS CUSTOM_ARGUMENTS )
85 MESSAGE(FATAL_ERROR ${ARGN})