You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by bp...@apache.org on 2014/06/11 22:49:55 UTC

svn commit: r1602012 - in /incubator/celix/trunk: cmake/CodeCoverage.cmake utils/CMakeLists.txt

Author: bpetri
Date: Wed Jun 11 20:49:54 2014
New Revision: 1602012

URL: http://svn.apache.org/r1602012
Log:
CELIX-123: added SET_TARGET_PROPERTY to prevent doubled execution of add_custom_target and in turn allow including CodeCoverage.cmake in framework (already in place) and utils



Modified:
    incubator/celix/trunk/cmake/CodeCoverage.cmake
    incubator/celix/trunk/utils/CMakeLists.txt

Modified: incubator/celix/trunk/cmake/CodeCoverage.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/CodeCoverage.cmake?rev=1602012&r1=1602011&r2=1602012&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/CodeCoverage.cmake (original)
+++ incubator/celix/trunk/cmake/CodeCoverage.cmake Wed Jun 11 20:49:54 2014
@@ -62,21 +62,26 @@ IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debu
   MESSAGE( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" )
 ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
 
-
 # Setup compiler options
 ADD_DEFINITIONS(--coverage)
 set(CMAKE_SHARED_LINKER_FLAGS "--coverage")
 set(CMAKE_EXE_LINKER_FLAGS "--coverage")
 
+GET_TARGET_PROPERTY(coverage_def coverage COVERAGE_TARGET_ADDED)
+IF(${coverage_def} MATCHES NOTFOUND)
+
 
-add_custom_target(coverage
-	COMMAND ${CMAKE_COMMAND} -E make_directory coverage_results
-	COMMAND ${GENHTML_PATH} -o coverage_results coverage/*.info.cleaned
-	COMMAND ${CMAKE_COMMAND} -E remove_directory coverage
+    add_custom_target(coverage
+	    COMMAND ${CMAKE_COMMAND} -E make_directory coverage_results
+	    COMMAND ${GENHTML_PATH} -o coverage_results coverage/*.info.cleaned
+	    COMMAND ${CMAKE_COMMAND} -E remove_directory coverage
 	
-	WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-	COMMENT "Generating report.\nOpen ./${_outputname}/index.html in your browser to view the coverage report."
-)
+	    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+	    COMMENT "Generating report.\nOpen ./${_outputname}/index.html in your browser to view the coverage report."
+    )
+
+    SET_TARGET_PROPERTIES(coverage PROPERTIES COVERAGE_TARGET_ADDED "")
+ENDIF()
 
 # Param _targetname     The name of new the custom make target
 # Param _testrunner     The name of the target which runs the tests
@@ -112,4 +117,4 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targ
 		COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
 	)
 	ADD_DEPENDENCIES(coverage ${_targetname})
-ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
+ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
\ No newline at end of file

Modified: incubator/celix/trunk/utils/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/CMakeLists.txt?rev=1602012&r1=1602011&r2=1602012&view=diff
==============================================================================
--- incubator/celix/trunk/utils/CMakeLists.txt (original)
+++ incubator/celix/trunk/utils/CMakeLists.txt Wed Jun 11 20:49:54 2014
@@ -1,91 +1,95 @@
-# 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.
-
-celix_subproject(UTILS "Option to build the utilities library" "ON")
-if (UTILS) 
-    cmake_minimum_required(VERSION 2.6)
-    
-    add_definitions(-DUSE_FILE32API)
-    #aux_source_directory("private/src" SRC)
-    include_directories("private/include")
-    include_directories("public/include")
-    add_library(celix_utils SHARED 
-		private/src/array_list.c
-		public/include/array_list.h 
-		private/include/array_list_private.h 
-
-		private/src/hash_map.c
-		public/include/hash_map.h 
-		private/include/hash_map_private.h
-
-		private/src/linked_list.c
-		private/src/linked_list_iterator.c
-		public/include/linked_list.h
-		public/include/linked_list_iterator.h 
-		private/include/linked_list_private.h
-
-		private/src/netstring.c
-		public/include/netstring.h
-		public/include/exports.h
-		
-		private/src/celix_threads.c
-	)
-    
-    IF(UNIX)
-    	target_link_libraries(celix_utils m)
-    ENDIF(UNIX)
-    target_link_libraries(celix_utils ${APR_LIBRARY})
-    
-    install(TARGETS celix_utils DESTINATION lib COMPONENT framework)
-    FILE(GLOB files "public/include/*.h")
-    INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)
-    
-    celix_subproject(UTILS-TESTS "Option to build the utilities library tests" "OFF")
-    if (UTILS-TESTS)
-	    include_directories(${CUNIT_INCLUDE_DIRS})
-	    include_directories(${CPPUTEST_INCLUDE_DIR})
-	    include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-	    include_directories("${PROJECT_SOURCE_DIR}/utils/private/include")
-	    
-	    add_executable(hash_map_test private/test/hash_map_test.c)
-	    target_link_libraries(hash_map_test celix_utils ${CUNIT_LIBRARIES})
-	    
-	    add_executable(hash_map_test_hash private/test/hash_map_test_hash.c)
-	    target_link_libraries(hash_map_test_hash celix_utils ${CUNIT_LIBRARIES})
-	    
-	    add_executable(array_list_test2 private/test/array_list_test.c)
-	    target_link_libraries(array_list_test2 celix_utils ${CUNIT_LIBRARIES})
-	    
-	    add_executable(array_list_test private/test/array_list_test.cpp)
-		target_link_libraries(array_list_test celix_utils ${CPPUTEST_LIBRARY})
-	    
-	    add_executable(linked_list_test private/test/linked_list_test.c)
-	    target_link_libraries(linked_list_test celix_utils ${CUNIT_LIBRARIES})
-
-	    add_executable(netstring_test private/test/netstring_test.c)
-	    target_link_libraries(netstring_test celix_utils celix_framework ${CUNIT_LIBRARIES})
-		    
-	    
-	    run_test(array_list_test2)
-	    run_test(hash_map_test)
-	    run_test(hash_map_test_hash)
-	    run_test(linked_list_test)
-	    run_test(netstring_test)
-	    
-	    ADD_TARGET_FOR_TEST(array_list_test)
-    endif(UTILS-TESTS)
+# 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.
+
+celix_subproject(UTILS "Option to build the utilities library" "ON")
+if (UTILS) 
+    cmake_minimum_required(VERSION 2.6)
+    
+    add_definitions(-DUSE_FILE32API)
+    #aux_source_directory("private/src" SRC)
+    include_directories("private/include")
+    include_directories("public/include")
+    add_library(celix_utils SHARED 
+		private/src/array_list.c
+		public/include/array_list.h 
+		private/include/array_list_private.h 
+
+		private/src/hash_map.c
+		public/include/hash_map.h 
+		private/include/hash_map_private.h
+
+		private/src/linked_list.c
+		private/src/linked_list_iterator.c
+		public/include/linked_list.h
+		public/include/linked_list_iterator.h 
+		private/include/linked_list_private.h
+
+		private/src/netstring.c
+		public/include/netstring.h
+		public/include/exports.h
+		
+		private/src/celix_threads.c
+	)
+    
+    IF(UNIX)
+    	target_link_libraries(celix_utils m)
+    ENDIF(UNIX)
+    target_link_libraries(celix_utils ${APR_LIBRARY})
+    
+    install(TARGETS celix_utils DESTINATION lib COMPONENT framework)
+    FILE(GLOB files "public/include/*.h")
+    INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)
+    
+    celix_subproject(UTILS-TESTS "Option to build the utilities library tests" "OFF")
+    if (UTILS-TESTS)
+    	include(${CMAKE_SOURCE_DIR}/cmake/CodeCoverage.cmake)
+    	find_package(CppUTest REQUIRED)
+
+	    include_directories(${CUNIT_INCLUDE_DIRS})
+	    include_directories(${CPPUTEST_INCLUDE_DIR})
+	    include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+	    include_directories("${PROJECT_SOURCE_DIR}/utils/private/include")
+	    
+	    add_executable(hash_map_test private/test/hash_map_test.c)
+	    target_link_libraries(hash_map_test celix_utils ${CUNIT_LIBRARIES})
+	    
+	    add_executable(hash_map_test_hash private/test/hash_map_test_hash.c)
+	    target_link_libraries(hash_map_test_hash celix_utils ${CUNIT_LIBRARIES})
+	    
+	    add_executable(array_list_test2 private/test/array_list_test.c)
+	    target_link_libraries(array_list_test2 celix_utils ${CUNIT_LIBRARIES})
+	    
+	    add_executable(array_list_test private/test/array_list_test.cpp)
+		target_link_libraries(array_list_test celix_utils ${CPPUTEST_LIBRARY})
+	    
+	    add_executable(linked_list_test private/test/linked_list_test.c)
+	    target_link_libraries(linked_list_test celix_utils ${CUNIT_LIBRARIES})
+
+	    add_executable(netstring_test private/test/netstring_test.c)
+	    target_link_libraries(netstring_test celix_utils celix_framework ${CUNIT_LIBRARIES})
+		    
+	    
+	    run_test(array_list_test2)
+	    run_test(hash_map_test)
+	    run_test(hash_map_test_hash)
+	    run_test(linked_list_test)
+	    run_test(netstring_test)
+	    
+	    ADD_TARGET_FOR_TEST(array_list_test)
+        SETUP_TARGET_FOR_COVERAGE(array_list_test_c array_list_test ${CMAKE_BINARY_DIR}/coverage/array_list_test)
+    endif(UTILS-TESTS)
 endif (UTILS)