CMakeLists.txt
96 lines
| 3.3 KiB
| text/plain
|
CMakeLexer
r1331 | cmake_minimum_required(VERSION 3.6) | |||
project(SciQLOP CXX) | ||||
r0 | ||||
r1331 | include(GNUInstallDirs) | |||
r0 | ||||
r1331 | SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake") | |||
r0 | ||||
r1331 | OPTION (CPPCHECK "Analyzes the source code with cppcheck" OFF) | |||
OPTION (CLANG_TIDY "Analyzes the source code with Clang Tidy" OFF) | ||||
OPTION (IWYU "Analyzes the source code with Include What You Use" OFF) | ||||
r1354 | OPTION (Coverage "Enables code coverage" OFF) | |||
r1406 | OPTION (BUILD_APP "Build SciQLop application" ON) | |||
OPTION (BUILD_CORE "Build SciQLop Core module" ON) | ||||
OPTION (BUILD_GUI "Build SciQLop GUI module" ON) | ||||
OPTION (BUILD_PLUGINS "Build SciQLop plugins" ON) | ||||
r1062 | ||||
r1347 | set(CMAKE_CXX_STANDARD 17) | |||
r1062 | ||||
r1331 | set(CMAKE_AUTOMOC ON) | |||
#https://gitlab.kitware.com/cmake/cmake/issues/15227 | ||||
#set(CMAKE_AUTOUIC ON) | ||||
if(POLICY CMP0071) | ||||
cmake_policy(SET CMP0071 OLD) | ||||
endif() | ||||
set(CMAKE_AUTORCC ON) | ||||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||||
if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH) | ||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||||
endif() | ||||
if(NOT DEFINED CMAKE_MACOSX_RPATH) | ||||
set(CMAKE_MACOSX_RPATH TRUE) | ||||
endif() | ||||
if(NOT CMAKE_BUILD_TYPE) | ||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) | ||||
endif() | ||||
r1365 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3") | |||
r1331 | ||||
find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) | ||||
IF(CPPCHECK) | ||||
set(CMAKE_CXX_CPPCHECK "cppcheck;--enable=warning,style") | ||||
ENDIF(CPPCHECK) | ||||
IF(CLANG_TIDY) | ||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-style=file;-checks=*") | ||||
ENDIF(CLANG_TIDY) | ||||
IF(IWYU) | ||||
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use") | ||||
ENDIF(IWYU) | ||||
r1354 | IF(Coverage) | |||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") | ||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -Wall -W -Wshadow -Wunused-variable \ | ||||
-Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \ | ||||
-Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") | ||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") | ||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gcov.html | ||||
COMMAND gcovr --exclude='.*Test.*' --exclude='.*external.*' --object-directory ${CMAKE_BINARY_DIR} -r ${CMAKE_SOURCE_DIR} --html --html-details -o ${CMAKE_CURRENT_BINARY_DIR}/gcov.html | ||||
) | ||||
add_custom_target(gcovr | ||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr | ||||
) | ||||
add_custom_target(show_coverage | ||||
COMMAND xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html | ||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gcov.html gcovr | ||||
) | ||||
ENDIF(Coverage) | ||||
r1331 | enable_testing() | |||
r1406 | if(BUILD_CORE) | |||
find_package(SciQLOPCore CONFIG QUIET) | ||||
if (NOT SciQLOPCore_FOUND) | ||||
if(NOT IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/core) | ||||
message("Init submodule Core") | ||||
execute_process(COMMAND git submodule init core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||||
execute_process(COMMAND git submodule update core WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||||
endif() | ||||
add_subdirectory(core) | ||||
r1352 | endif() | |||
r1348 | endif() | |||
r1406 | if(BUILD_GUI) | |||
add_subdirectory(gui) | ||||
endif() | ||||
if(BUILD_APP) | ||||
add_subdirectory(app) | ||||
endif() | ||||
if(BUILD_PLUGINS) | ||||
add_subdirectory(plugins) | ||||
endif() | ||||
r1353 | #add_subdirectory(docs) | |||