Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cmake: Add coverage support.

  • Loading branch information...
commit b46f10a11fbb5a8426c28e9113fff57cb7405958 1 parent a1138c6
@thughes thughes authored ry committed
View
22 CMakeLists.txt
@@ -1,6 +1,20 @@
cmake_minimum_required(VERSION 2.6)
project(node)
+if(USE_GCOV)
+ set(CMAKE_BUILD_TYPE "Debug")
+
+ # Set global c and c++ flags
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+
+ # Link flags used for creating executables
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -fprofile-arcs")
+
+ # Link flags used for creating shared libraries
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -profile-arcs")
+endif()
+
#
# options
#
@@ -72,5 +86,9 @@ if(${OPENSSL_FOUND} MATCHES TRUE)
message(" OpenSSL: ${OPENSSL_LIBRARIES}")
endif()
-# message(" CCFLAGS: ${CCFLAGS}")
-# message(" CPPFLAGS: ${CPPFLAGS}")
+if(USE_GCOV)
+ message(" gcov: enabled")
+endif()
+
+message(" CCFLAGS: ${CCFLAGS}")
+message(" CPPFLAGS: ${CPPFLAGS}")
View
5 Makefile.cmake
@@ -30,4 +30,7 @@ test: $(BUILD)/Makefile
cdash: $(BUILD)/Makefile
cd $(BUILD) && make Experimental
-.PHONY: build install clean doc package test cdash
+cdash-cov: $(BUILD)/Makefile
+ cd $(BUILD) && $(CMAKE) -DUSE_GCOV=True .. && make Experimental
+
+.PHONY: build install clean doc package test cdash cdash-cov
View
4 README.cmake
@@ -30,6 +30,10 @@ To submit test results (see http://my.cdash.org/index.php?project=node):
make -f Makefile.cmake cdash
+To submit coverage test results:
+
+ make -f Makefile.cmake cdash-cov
+
Using cmake directly:
cd ~/your-node-source-dir
mkdir name-of-build-dir (can be anything)
View
9 cmake/configure.cmake
@@ -38,17 +38,16 @@ set(CMAKE_C_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CFLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CXXFLAGS}")
if(${node_platform} MATCHES sunos)
- # shouldn't this be added to CMAE_C_FLAGS or something?
add_definitions(-threads)
elseif(NOT ${node_platform} MATCHES cygwin*)
- # shouldn't this be added to CMAE_C_FLAGS or something?
add_definitions(-pthread)
- set(CMAKE_C_FLAGS -rdynamic)
- set(CMAKE_EXE_LINKER_FLAGS -pthread)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
endif()
if(${node_platform} MATCHES darwin)
- set(CMAKE_EXE_LINKER_FLAGS "-framework Carbon")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Carbon")
endif()
check_function_exists(fdatasync HAVE_FDATASYNC)
Please sign in to comment.
Something went wrong with that request. Please try again.