Skip to content
Snippets Groups Projects
Select Git revision
6 results Searching

maoxdb.hpp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    CMakeLists.txt 4.78 KiB
    #
    # This file is a part of the CaosDB Project.
    #
    # Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
    # Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU Affero General Public License as
    # published by the Free Software Foundation, either version 3 of the
    # License, or (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU Affero General Public License for more details.
    #
    # You should have received a copy of the GNU Affero General Public License
    # along with this program. If not, see <https://www.gnu.org/licenses/>.
    #
    
    #######################################################################
    ### append test cases here (file name without the ".cpp" suffix)
    #######################################################################
    set(test_cases
        test_connection
        test_transaction
        test_ccaosdb
        )
    
    
    include(CheckCXXCompilerFlag)
    include(CheckCCompilerFlag)
    
    function(add_compiler_flag flag)
        string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" cxx_present)
        if(cxx_present EQUAL -1)
            check_cxx_compiler_flag("${flag}" flag_supported)
            if(flag_supported)
                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
            endif()
            unset(flag_supported CACHE)
        endif()
        unset(cxx_present CACHE)
    endfunction()
    
    ### but ignore these
    add_compiler_flag("-Wno-unused-parameter")
    add_compiler_flag("-Wno-unused-result")
    add_compiler_flag("-g")
    
    #######################################################
    ### Linting with clang-tidy and include-what-you-use
    #######################################################
    option(LINTING "clang-tidy and iwye" ON)
    if(LINTING)
        ### set paranoid compiler flags
        #add_compiler_flag("-Wall")
        #add_compiler_flag("-Wextra")
        #add_compiler_flag("-pedantic")
        #add_compiler_flag("-Werror")
    
    
        find_program(iwyu
            NAMES include-what-you-use iwyu
            PATHS ${CMAKE_SOURCE_DIR}/tools/include-what-you-use/${iwyu_os}/bin)
        if(NOT iwyu)
            message(WARNING "include-what-you-use: Not found")
        else()
            message(STATUS "include-what-you-use: ${iwyu}")
            set(_CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${iwyu}