Fix cmake

This commit is contained in:
realaltffour 2020-04-18 12:33:44 +03:00
parent e5b7dfceff
commit afbcb53152
No known key found for this signature in database
GPG Key ID: 7115CD2AC9A76A56
4 changed files with 7 additions and 31 deletions

View File

@ -5,24 +5,14 @@ project("fixmydownloads" VERSION 0.0.1)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
# Code Coverage Configuration
add_library(coverage_config INTERFACE)
# Set C compiler options
if (NOT CODE_COVERAGE)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
endif(NOT CODE_COVERAGE)
option(CODE_COVERAGE "Enable coverage reporting" OFF)
if(CODE_COVERAGE)
# Add required flags (GCC & LLVM/Clang)
target_compile_options(coverage_config INTERFACE
-O0 # no optimization
-g # generate debug info
--coverage # sets all required flags
)
target_link_libraries(coverage_config INTERFACE --coverage)
endif(CODE_COVERAGE)
add_subdirectory(src)
enable_testing()
add_subdirectory(tests)
add_executable(fixmydl main.c)
target_compile_options(fixmydl PUBLIC -Wall -Werror -Wno-unused-function -pedantic)
install(TARGETS fixmydl
RUNTIME DESTINATION bin

View File

@ -1,4 +0,0 @@
coverage:
precision: 2
round: nearest
range: "90...100"

View File

View File

@ -1,10 +0,0 @@
# Set C compiler options
if (NOT CODE_COVERAGE)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
endif(NOT CODE_COVERAGE)
add_executable(fixmydl main.c)
target_compile_options(fixmydl PUBLIC -Wall -Werror -Wno-unused-function -pedantic)
target_link_libraries(fixmydl PUBLIC coverage_config)