From 1a5e87ea1a80f26873c25c3f7866867c32d8d42c Mon Sep 17 00:00:00 2001 From: Piotr Krysik Date: Sun, 4 Mar 2018 19:36:24 +0100 Subject: Conditional compilation of local libosmocore depending if there is or is not libosmocore installation present on the system --- CMakeLists.txt | 56 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 811cd93..8ad3445 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,10 +135,11 @@ set(GR_REQUIRED_COMPONENTS RUNTIME FILTER PMT) find_package(Gnuradio) find_package(Volk) find_package(CppUnit) -find_package(Doxygen) -#find_package(Libosmocore) -#find_package(Libosmocoding) -#find_package(Libosmocodec) +#find_package(Doxygen) +find_package(Libosmocore) +find_package(Libosmocodec) +find_package(Libosmocoding) + if(NOT GNURADIO_RUNTIME_FOUND) message(FATAL_ERROR "GnuRadio Runtime required to compile gr-gsm") @@ -146,18 +147,14 @@ endif() if(NOT VOLK_FOUND) message(FATAL_ERROR "Volk library required to compile gr-gsm") endif() -#if(NOT CPPUNIT_FOUND) -# message(FATAL_ERROR "CppUnit required to compile gr-gsm") -#endif() -#if(NOT LIBOSMOCORE_FOUND) -# message(FATAL_ERROR "Libosmocore required to compile gr-gsm") -#endif() -#if(NOT LIBOSMOCODEC_FOUND) -# message(FATAL_ERROR "Libosmocodec required to compile gr-gsm") -#endif() -#if(NOT LIBOSMOCODING_FOUND) -# message(FATAL_ERROR "Libosmocoding required to compile gr-gsm") -#endif() +if(NOT CPPUNIT_FOUND) + message(FATAL_ERROR "CppUnit required to compile gr-gsm") +endif() +if(NOT LIBOSMOCORE_FOUND OR NOT LIBOSMOCODEC_FOUND) + message(STATUS "Compiling local version of libosmocore and libosmocodec") +elseif(NOT LIBOSMOCODING_FOUND) + message(STATUS "Compiling local version of libosmocoding") +endif() ######################################################################## # Setup doxygen option @@ -165,13 +162,13 @@ endif() #if(DOXYGEN_FOUND) # option(ENABLE_DOXYGEN "Build docs using Doxygen" ON) #else(DOXYGEN_FOUND) - option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF) + option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF) #TODO: write doxygen docs #endif(DOXYGEN_FOUND) ######################################################################## # Setup the include and linker paths ######################################################################## -include_directories( +list (APPEND grgsm_include_directories ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/lib @@ -179,16 +176,35 @@ include_directories( ${Boost_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} ${GNURADIO_ALL_INCLUDE_DIRS} -# ${LIBOSMOCORE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/lib/decoding ) -link_directories( +if(LIBOSMOCORE_FOUND) + list (APPEND grgsm_include_directories + ${LIBOSMOCORE_INCLUDE_DIR} + ) +endif() + +include_directories( + ${grgsm_include_directories} +) + +list (APPEND ${Boost_LIBRARY_DIRS} ${CPPUNIT_LIBRARY_DIRS} ${GNURADIO_ALL_LIBRARY_DIRS} ) +if(LIBOSMOCORE_FOUND) + list (APPEND grgsm_link_directories + ${LIBOSMOCORE_LIBRARY_DIRS} + ) +endif() + +link_directories( + ${grgsm_link_directories} +) + # Set component parameters set(GR_GSM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) set(GR_GSM_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE) -- cgit v1.2.3