You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2019/01/07 20:11:57 UTC

[celix] 09/22: CELIX-438; Adds CppuTest as external cmake project

This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/cxx
in repository https://gitbox.apache.org/repos/asf/celix.git

commit e4dab3190b04ae0f99b5e965247087360582736d
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Sat Jan 5 13:54:55 2019 +0100

    CELIX-438; Adds CppuTest as external cmake project
---
 CMakeLists.txt                        |  1 +
 cmake/celix_project/AddCppUTest.cmake | 46 +++++++++++++++++++++++++++++++++++
 cmake/celix_project/AddGLog.cmake     |  2 +-
 cmake/celix_project/AddLibzip.cmake   |  2 +-
 libs/dfi/CMakeLists.txt               |  4 +--
 libs/utils/CMakeLists.txt             |  2 +-
 6 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d0b790..968e74c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,6 +56,7 @@ option(ENABLE_TESTING "Enables unit testing" ON)
 if (ENABLE_TESTING)
 	enable_testing()
     include(cmake/celix_project/AddGTest.cmake)
+    include(cmake/celix_project/AddCppUTest.cmake)
 endif ()
 include(cmake/celix_project/AddGLog.cmake)
 include(cmake/celix_project/AddLibzip.cmake)
diff --git a/cmake/celix_project/AddCppUTest.cmake b/cmake/celix_project/AddCppUTest.cmake
new file mode 100644
index 0000000..f989e73
--- /dev/null
+++ b/cmake/celix_project/AddCppUTest.cmake
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include(ExternalProject)
+ExternalProject_Add(
+        cpputest_project
+        GIT_REPOSITORY https://github.com/cpputest/cpputest.git
+        GIT_TAG v3.8
+        UPDATE_DISCONNECTED TRUE
+        PREFIX ${CMAKE_BINARY_DIR}/cpputest
+        CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/cpputest
+)
+
+file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/cpputest/include)
+
+set(CPPUTEST_LIBRARY cpputest::cpputest)
+set(CPPUTEST_EXT_LIBRARY cpputest::ext)
+set(CPPUTEST_INCLUDE_DIR ${binary_dir}/cpputest)
+
+add_library(cpputest::cpputest IMPORTED STATIC GLOBAL)
+add_dependencies(cpputest::cpputest cpputest_project)
+set_target_properties(cpputest::cpputest PROPERTIES
+        IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/cpputest/lib/libCppUTest.a"
+        INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/cpputest/include"
+)
+
+add_library(cpputest::ext IMPORTED STATIC GLOBAL)
+add_dependencies(cpputest::ext cpputest_project)
+set_target_properties(cpputest::ext PROPERTIES
+        IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/cpputest/lib/libCppUTestExt.a"
+        INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/cpputest/include"
+)
diff --git a/cmake/celix_project/AddGLog.cmake b/cmake/celix_project/AddGLog.cmake
index df0f3ab..fe0137f 100644
--- a/cmake/celix_project/AddGLog.cmake
+++ b/cmake/celix_project/AddGLog.cmake
@@ -26,7 +26,7 @@ ExternalProject_Add(
         CMAKE_ARGS -DWITH_GFLAGS=OFF -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/glog -DCMAKE_CXX_FLAGS=-w
 )
 
-file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/glog/include/dummy.txt CONTENT "//Dummy file to ensure the include dir exists")
+file(MAKE_DIRECTORY ${source_dir}/glog/include)
 
 add_library(glog::glog IMPORTED STATIC GLOBAL)
 add_dependencies(glog::glog googlelog_project)
diff --git a/cmake/celix_project/AddLibzip.cmake b/cmake/celix_project/AddLibzip.cmake
index aec4be7..19f8f15 100644
--- a/cmake/celix_project/AddLibzip.cmake
+++ b/cmake/celix_project/AddLibzip.cmake
@@ -25,7 +25,7 @@ ExternalProject_Add(
         CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libzip -DCMAKE_C_FLAGS=-fPIC -DBUILD_SHARED_LIBS=OFF -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_OPENSSL=OFF -Wno-dev
 )
 
-file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/libzip/include/dummy.txt CONTENT "//Dummy file to ensure the include dir exists")
+file(MAKE_DIRECTORY ${source_dir}/libzip/include)
 
 add_library(libzip::libzip IMPORTED STATIC GLOBAL)
 add_dependencies(libzip::libzip libzip_project)
diff --git a/libs/dfi/CMakeLists.txt b/libs/dfi/CMakeLists.txt
index 4da08b0..4451ff7 100644
--- a/libs/dfi/CMakeLists.txt
+++ b/libs/dfi/CMakeLists.txt
@@ -65,8 +65,8 @@ if (ENABLE_TESTING)
 		test/json_rpc_tests.cpp
 		test/run_tests.cpp
 	)
-	target_link_libraries(test_dfi PRIVATE Celix::dfi Celix::utils ${FFI_LIBRARIES} ${CPPUTEST_LIBRARY})
-	target_include_directories(test_dfi PRIVATE ${FFI_INCLUDE_DIRS})
+	target_link_libraries(test_dfi PRIVATE Celix::dfi Celix::utils ${FFI_LIBRARIES} ${CPPUTEST_LIBRARY} ${JANSSON_LIBRARY})
+	target_include_directories(test_dfi PRIVATE ${FFI_INCLUDE_DIRS} ${JANSSON_INCLUDE_DIRS})
 
     file(COPY ${CMAKE_CURRENT_LIST_DIR}/test/schemas DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
     file(COPY ${CMAKE_CURRENT_LIST_DIR}/test/descriptors DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt
index 5f211bf..e0afe41 100644
--- a/libs/utils/CMakeLists.txt
+++ b/libs/utils/CMakeLists.txt
@@ -71,7 +71,7 @@ add_library(Celix::utils ALIAS utils)
 
 celix_subproject(UTILS-TESTS "Option to build the utilities library tests" "OFF")
 if (ENABLE_TESTING AND UTILS-TESTS)
-    find_package(CppUTest REQUIRED)
+    #find_package(CppUTest REQUIRED)
 
     include_directories(SYSTEM ${CPPUTEST_INCLUDE_DIR})
     include_directories(include)