summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-01-26 11:13:01 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-01-26 14:23:24 -0200
commit8de264f597ba28dea688dfe318dc2e863cc76f4f (patch)
tree354b391cec40962a93a1be3394e7eff129cb488a /cmake
parent8cb493dd0120e82c7761f67453c34d81e46c245b (diff)
cmake: pkg-config can have version and needs HAVE/ENABLED defines.
pkg-config names can be encoded with a version requirement, such as zlib>=1.2.3, thus we need to remove that from the variable. with autotools we used HAVE_XXX and ENABLED_XXX to instruct such optional library was present, then define that just for the user target by adding that to its CFLAGS. This allows us to remove some defines that matches the name, only leave those that translate from original pkg-config name, such as libsystemd->systemd.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/config/common.cmake2
-rw-r--r--cmake/helpers/EflMacros.cmake11
2 files changed, 8 insertions, 5 deletions
diff --git a/cmake/config/common.cmake b/cmake/config/common.cmake
index 5056928e56..8a9ab4743e 100644
--- a/cmake/config/common.cmake
+++ b/cmake/config/common.cmake
@@ -72,7 +72,6 @@ TYPE_CHECK(siginfo_t INCLUDE_FILES signal.h)
72# TODO: move to a FindUnwind.cmake? 72# TODO: move to a FindUnwind.cmake?
73# or is pkg-config enough these days? 73# or is pkg-config enough these days?
74pkg_check_modules(UNWIND libunwind libunwind-generic) 74pkg_check_modules(UNWIND libunwind libunwind-generic)
75CHECK_APPEND_DEFINE(HAVE_UNWIND ${UNWIND_FOUND})
76 75
77CHECK_APPEND_DEFINE(EFL_BETA_API_SUPPORT 1) 76CHECK_APPEND_DEFINE(EFL_BETA_API_SUPPORT 1)
78if(CMAKE_THREAD_LIBS_INIT) 77if(CMAKE_THREAD_LIBS_INIT)
@@ -81,7 +80,6 @@ endif()
81CHECK_APPEND_DEFINE(EFL_HAVE_THREADS "${EFL_HAVE_THREADS}") 80CHECK_APPEND_DEFINE(EFL_HAVE_THREADS "${EFL_HAVE_THREADS}")
82 81
83CHECK_APPEND_DEFINE(HAVE_SYSTEMD ${ENABLE_SYSTEMD}) 82CHECK_APPEND_DEFINE(HAVE_SYSTEMD ${ENABLE_SYSTEMD})
84CHECK_APPEND_DEFINE(HAVE_VALGRIND ${ENABLE_VALGRIND})
85 83
86CHECK_APPEND_DEFINE(MODULE_ARCH "\"v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}\"") 84CHECK_APPEND_DEFINE(MODULE_ARCH "\"v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}\"")
87CHECK_APPEND_DEFINE(SHARED_LIB_SUFFIX "\"${CMAKE_SHARED_LIBRARY_SUFFIX}\"") 85CHECK_APPEND_DEFINE(SHARED_LIB_SUFFIX "\"${CMAKE_SHARED_LIBRARY_SUFFIX}\"")
diff --git a/cmake/helpers/EflMacros.cmake b/cmake/helpers/EflMacros.cmake
index 95decbe976..c081ed1120 100644
--- a/cmake/helpers/EflMacros.cmake
+++ b/cmake/helpers/EflMacros.cmake
@@ -420,13 +420,18 @@ function(EFL_PKG_CONFIG_EVAL_TO _var _name)
420 set(_missing "") 420 set(_missing "")
421 set(_missing_optional "") 421 set(_missing_optional "")
422 set(_optional OFF) 422 set(_optional OFF)
423 set(_have_definitions "")
423 foreach(f ${ARGN}) 424 foreach(f ${ARGN})
424 if(${f} STREQUAL "OPTIONAL") 425 if(${f} STREQUAL "OPTIONAL")
425 set(_optional ON) 426 set(_optional ON)
426 else() 427 else()
427 pkg_check_modules(PKG_CONFIG_DEP_${f} ${f}) 428 string(REGEX REPLACE "[><=].*\$" "" v "${f}")
428 if(PKG_CONFIG_DEP_${f}_FOUND) 429 string(REGEX REPLACE "[^A-Za-z0-9]" "_" v "${v}")
430 string(TOUPPER "${v}" v)
431 pkg_check_modules(PKG_CONFIG_DEP_${v} ${f})
432 if(PKG_CONFIG_DEP_${v}_FOUND)
429 list(APPEND _found ${f}) 433 list(APPEND _found ${f})
434 list(APPEND _have_definitions "-DHAVE_${v}=1" "-DENABLE_${v}=1")
430 elseif(_optional) 435 elseif(_optional)
431 list(APPEND _missing_optional ${f}) 436 list(APPEND _missing_optional ${f})
432 LIST_APPEND_GLOBAL(EFL_PKG_CONFIG_MISSING_OPTIONAL ${f}) 437 LIST_APPEND_GLOBAL(EFL_PKG_CONFIG_MISSING_OPTIONAL ${f})
@@ -442,7 +447,7 @@ function(EFL_PKG_CONFIG_EVAL_TO _var _name)
442 447
443 if(_found) 448 if(_found)
444 pkg_check_modules(PKG_CONFIG_${_var} ${_found}) 449 pkg_check_modules(PKG_CONFIG_${_var} ${_found})
445 SET_GLOBAL(${_var}_CFLAGS "${PKG_CONFIG_${_var}_CFLAGS}") 450 SET_GLOBAL(${_var}_CFLAGS "${_have_definitions};${PKG_CONFIG_${_var}_CFLAGS}")
446 SET_GLOBAL(${_var}_LDFLAGS "${PKG_CONFIG_${_var}_LDFLAGS}") 451 SET_GLOBAL(${_var}_LDFLAGS "${PKG_CONFIG_${_var}_LDFLAGS}")
447 endif() 452 endif()
448 else() 453 else()