This is an automated email from the ASF dual-hosted git repository. abroekhuis pushed a commit to branch feature/support_multiple_build_types in repository https://gitbox.apache.org/repos/asf/celix.git
commit 78c31b83d62cc052b49f1f8511a59f15b457660c Merge: 5bc6333 1d02e16 Author: Alexander Broekhuis <[email protected]> AuthorDate: Thu May 7 20:53:50 2020 +0200 Merge branch 'master' of github.com:apache/celix into feature/support_multiple_build_types * 'master' of github.com:apache/celix: Delete .travis.yml Added back effc++ flag. Moved gtest inclusion before the flags to prevent compiler failures due to w_error. Fixed GTest includes to proper name Removed -Weffc++ to be able to compile gtest with GCC Updated gtest setup to either use GTest supplied Config file, or (if not found) download via Cmake's FetchContent. Updated usage to correct alias. # Conflicts: # CMakeLists.txt .travis.yml | 85 ---------------------- CMakeLists.txt | 14 ++-- bundles/logging/log_admin/gtest/CMakeLists.txt | 2 +- bundles/logging/log_helper/gtest/CMakeLists.txt | 2 +- .../log_writers/syslog_writer/gtest/CMakeLists.txt | 2 +- .../pubsub_protocol_wire_v1/gtest/CMakeLists.txt | 2 +- .../remote_service_admin_dfi/gtest/CMakeLists.txt | 2 +- cmake/AddGTest.cmake | 39 +++------- libs/dfi/gtest/CMakeLists.txt | 2 +- libs/framework/gtest/CMakeLists.txt | 2 +- libs/utils/gtest/CMakeLists.txt | 2 +- 11 files changed, 24 insertions(+), 130 deletions(-) diff --cc CMakeLists.txt index 80b940d,1f3f158..38b1612 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@@ -32,21 -32,30 +32,28 @@@ IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINO message( FATAL_ERROR "Building Celix using CMake 3.3 and makefiles is not supported due to a bug in the Makefile Generator (see Bug 15696). Please change the used CMake version - both, CMake 3.2 and CMake 3.4 are working fine. Or use a different generator (e.g. Ninja)." ) ENDIF() + if (ENABLE_TESTING) + find_package(GTest CONFIG QUIET) + if (NOT GTest_FOUND) + include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/AddGTest.cmake) + endif() + endif () + -set(ENABLE_W_ERROR ON) set(ENABLE_MORE_WARNINGS OFF) -IF (ANDROID) - set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall ${CMAKE_C_FLAGS}") -ELSE () - set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -fPIC ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-std=c++11 -fno-rtti ${CMAKE_CXX_FLAGS}") - set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-Wall -Wextra -Weffc++ ${CMAKE_CXX_FLAGS}") - set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG ${CMAKE_CXX_FLAGS}") -ENDIF() +# Set C specific flags +set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -fPIC ${CMAKE_C_FLAGS}") +set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") + +# Set C++ specific flags +set(CMAKE_CXX_FLAGS "-std=c++11 -fno-rtti ${CMAKE_CXX_FLAGS}") +set(CMAKE_CXX_FLAGS "-Wall -Werror -Wextra -Weffc++ ${CMAKE_CXX_FLAGS}") -IF(APPLE) +if(APPLE) set(CMAKE_MACOSX_RPATH 1) -ELSE () +endif() + +if(NOT APPLE) set(CMAKE_C_FLAGS "-pthread ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}")
