File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 2.6 )
22project (node)
33
4+ if (USE_GCOV)
5+ set (CMAKE_BUILD_TYPE "Debug" )
6+
7+ # Set global c and c++ flags
8+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage" )
9+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage" )
10+
11+ # Link flags used for creating executables
12+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -fprofile-arcs" )
13+
14+ # Link flags used for creating shared libraries
15+ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -profile-arcs" )
16+ endif ()
17+
418#
519# options
620#
@@ -72,5 +86,9 @@ if(${OPENSSL_FOUND} MATCHES TRUE)
7286 message (" OpenSSL: ${OPENSSL_LIBRARIES} " )
7387endif ()
7488
75- # message(" CCFLAGS: ${CCFLAGS}")
76- # message(" CPPFLAGS: ${CPPFLAGS}")
89+ if (USE_GCOV)
90+ message (" gcov: enabled" )
91+ endif ()
92+
93+ message (" CCFLAGS: ${CCFLAGS} " )
94+ message (" CPPFLAGS: ${CPPFLAGS} " )
Original file line number Diff line number Diff line change @@ -30,4 +30,7 @@ test: $(BUILD)/Makefile
3030cdash: $ (BUILD )/Makefile
3131 cd $ (BUILD ) && make Experimental
3232
33- .PHONY: build install clean doc package test cdash
33+ cdash-cov: $ (BUILD )/Makefile
34+ cd $ (BUILD ) && $ (CMAKE ) -DUSE_GCOV=True .. && make Experimental
35+
36+ .PHONY: build install clean doc package test cdash cdash-cov
Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ To submit test results (see http://my.cdash.org/index.php?project=node):
3030
3131 make -f Makefile.cmake cdash
3232
33+ To submit coverage test results:
34+
35+ make -f Makefile.cmake cdash-cov
36+
3337Using cmake directly:
3438 cd ~/your-node-source-dir
3539 mkdir name -of-build-dir (can be anything )
Original file line number Diff line number Diff line change @@ -38,17 +38,16 @@ set(CMAKE_C_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CFLAGS}")
3838set (CMAKE_CXX_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CXXFLAGS} " )
3939
4040if (${node_platform} MATCHES sunos)
41- # shouldn't this be added to CMAE_C_FLAGS or something?
4241 add_definitions (-threads )
4342elseif (NOT ${node_platform} MATCHES cygwin *)
44- # shouldn't this be added to CMAE_C_FLAGS or something?
4543 add_definitions (-pthread )
46- set (CMAKE_C_FLAGS -rdynamic)
47- set (CMAKE_EXE_LINKER_FLAGS -pthread)
44+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic" )
45+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic" )
46+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread" )
4847endif ()
4948
5049if (${node_platform} MATCHES darwin)
51- set (CMAKE_EXE_LINKER_FLAGS "-framework Carbon" )
50+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Carbon" )
5251endif ()
5352
5453check_function_exists (fdatasync HAVE_FDATASYNC )
You can’t perform that action at this time.
0 commit comments