Skip to content

Commit

Permalink
Only enable coverage on the core library
Browse files Browse the repository at this point in the history
Fixes #62
  • Loading branch information
gergondet committed Dec 21, 2016
1 parent 9d00af9 commit 89d0d5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@ IF(HAS_VISIBILITY)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
ENDIF()

# If we were given coverage options, we will only pass them to the core
# library.
SET(GENERATE_COVERAGE FALSE CACHE BOOL "Generate coverage data")
IF("${CMAKE_CXX_FLAGS}" MATCHES "--coverage")
SET(GENERATE_COVERAGE TRUE CACHE BOOL "Generate coverage data" FORCE)
STRING(REPLACE "--coverage" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
STRING(REPLACE "--coverage" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
STRING(REPLACE "--coverage" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
ENDIF()

# Search for dependencies.
SET(BOOST_COMPONENTS date_time filesystem system unit_test_framework)
SEARCH_FOR_BOOST()
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ ENDIF()
# Main library.
ADD_LIBRARY(roboptim-core SHARED ${HEADERS} ${ROBOPTIM_CORE_SRC})
TARGET_COMPILE_OPTIONS(roboptim-core PUBLIC "-Droboptim_core_EXPORTS")
IF(GENERATE_COVERAGE)
TARGET_COMPILE_OPTIONS(roboptim-core PRIVATE "--coverage")
SET_TARGET_PROPERTIES(roboptim-core PROPERTIES LINK_FLAGS "--coverage")
ENDIF()
PKG_CONFIG_USE_DEPENDENCY(roboptim-core liblog4cxx)

# Add required libs to pkg-config file.
Expand Down

0 comments on commit 89d0d5b

Please sign in to comment.