summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-20 01:36:46 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-20 01:36:46 -0500
commitc8e91af6c8bf7566829a9812f5ff047f1f1e9570 (patch)
tree24208ce418e20d5bc37fcf03e333ce718345ddf7 /CMakeLists.txt
parentf490a429d28069fd40ed711adfea13e0c4cd0651 (diff)
downloadhorizon-c8e91af6c8bf7566829a9812f5ff047f1f1e9570.tar.gz
horizon-c8e91af6c8bf7566829a9812f5ff047f1f1e9570.tar.bz2
horizon-c8e91af6c8bf7566829a9812f5ff047f1f1e9570.tar.xz
horizon-c8e91af6c8bf7566829a9812f5ff047f1f1e9570.zip
CMake: Make lcov and RSpec first-class targets
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt42
1 files changed, 37 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94af0d1..a311188 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,10 +8,24 @@ project(Horizon
VERSION 0.1.0)
option(BUILD_TOOLS "Enable building of tools (Validator, Simulator, etc)" ON)
+
+
+## Code Coverage stuff ##
option(COVERAGE "Build for code coverage tests (slow)" OFF)
+IF(COVERAGE)
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
+ SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --coverage")
+ENDIF(COVERAGE)
+
+
+## Valgrind stuff ##
+find_program(VALGRIND_EXECUTABLE NAMES valgrind)
+IF(VALGRIND_EXECUTABLE)
option(VALGRIND "Run Valgrind during test phase" OFF)
-option(INSTALL "Build Installation Environment support (Linux only)" ON)
+ENDIF(VALGRIND_EXECUTABLE)
+
+## Firmware stuff ##
option(UNSUPPORTED_NONFREE_FIRMWARE "Support loading and installation of non-libre firmware (DANGEROUS)" OFF)
mark_as_advanced(FORCE UNSUPPORTED_NONFREE_FIRMWARE)
@@ -19,6 +33,10 @@ IF(UNSUPPORTED_NONFREE_FIRMWARE)
add_definitions(-DNON_LIBRE_FIRMWARE)
ENDIF(UNSUPPORTED_NONFREE_FIRMWARE)
+
+## Installation Environment support stuff ##
+option(INSTALL "Build Installation Environment support (Linux only)" ON)
+
check_include_files(linux/wireless.h HAVE_LINUX_WIRELESS_H)
IF(NOT HAVE_LINUX_WIRELESS_H)
SET(INSTALL OFF)
@@ -32,15 +50,29 @@ IF(INSTALL)
find_library(BCNM_LIBRARY REQUIRED wpactrl PATH_SUFFIXES bcnm)
ENDIF(INSTALL)
-IF(COVERAGE)
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
- SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --coverage")
-ENDIF(COVERAGE)
include_directories(.)
+
+
+## Test stuff ##
+find_program(RSPEC_EXECUTABLE NAMES rspec)
enable_testing()
add_subdirectory(hscript)
IF(BUILD_TOOLS)
add_subdirectory(tools)
ENDIF(BUILD_TOOLS)
+
+
+IF(COVERAGE)
+ find_program(LCOV_EXECUTABLE NAMES lcov)
+
+ IF(LCOV_EXECUTABLE)
+ add_custom_command(OUTPUT horizon.coverage
+ COMMAND lcov ARGS --exclude '/usr/include/c++/*' --exclude '*/3rdparty/*' --capture --directory ${CMAKE_BINARY_DIR} --output-file horizon.coverage)
+ add_custom_target(lcov_report DEPENDS horizon.coverage)
+ add_custom_command(OUTPUT cov_html
+ COMMAND genhtml ARGS horizon.coverage --output-directory cov_html)
+ add_custom_target(lcov_html DEPEND cov_html)
+ ENDIF(LCOV_EXECUTABLE)
+ENDIF(COVERAGE)