From: Gerhard Sittig Date: Sun, 6 May 2018 09:29:19 +0000 (+0200) Subject: CMakeLists.txt: move includes to the top, earlier pkg-config lookup X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=723ac3f8c56bb5ed0b20f5911f6c449f114d35b6;p=pulseview.git CMakeLists.txt: move includes to the top, earlier pkg-config lookup Move some of the common cmake includes to a location near the top of the file. Lookup the pkg-config(1) utility before the construction of the list of dependendencies. Remaining subsequent includes are strictly conditional (backtrace), or belong to different groups than source compilation (VCS revision, CPack). --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bb72303..ffea00ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,13 @@ add_subdirectory(manual) #= Dependencies #------------------------------------------------------------------------------- +include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) +include(CMakePushCheckState) +include(memaccess) + +find_package(PkgConfig) + list(APPEND PKGDEPS glib-2.0>=2.28.0) list(APPEND PKGDEPS glibmm-2.4>=2.28.0) @@ -93,7 +100,6 @@ if(ANDROID) list(APPEND PKGDEPS libsigrokandroidutils>=0.1.0) endif() -find_package(PkgConfig) pkg_check_modules(LIBSRCXX ${LIBSR_CXX_BINDING}) if(NOT LIBSRCXX_FOUND OR NOT LIBSRCXX_VERSION) message(FATAL_ERROR "libsigrok C++ bindings missing, check libsigrok's 'configure' output (missing dependencies?)") @@ -151,8 +157,6 @@ find_package(Threads REQUIRED) # Helper for checking for atomics function(check_working_cxx_atomics varname additional_lib) - include(CheckCXXSourceCompiles) - include(CMakePushCheckState) cmake_push_check_state() set(CMAKE_REQUIRED_FLAGS "-std=c++11") set(CMAKE_REQUIRED_LIBRARIES "${additional_lib}") @@ -191,8 +195,6 @@ endif() # Check availability of features which depend on library versions. # TODO Ideally use check_symbol_exists() instead, reduce boilerplate. if(ENABLE_DECODE) - include(CheckCSourceCompiles) - include(CMakePushCheckState) cmake_push_check_state() set(CMAKE_REQUIRED_INCLUDES "${PKGDEPS_INCLUDE_DIRS}") set(CMAKE_REQUIRED_LIBRARIES "sigrokdecode") @@ -215,7 +217,6 @@ endif() #= System Introspection #------------------------------------------------------------------------------- -include(memaccess) memaccess_check_unaligned_le(HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS) #===============================================================================