Fix for incorrect compile flags in colobot-lint
parent
9ec289203b
commit
73536290b2
|
@ -202,6 +202,10 @@ option(GLEW_STATIC "Link statically with GLEW" OFF)
|
||||||
# Sometimes helpful if there is a different version of gtest installed on system vs bundled
|
# Sometimes helpful if there is a different version of gtest installed on system vs bundled
|
||||||
option(FORCE_BUNDLED_GTEST "Force the use of bundled gtest" OFF)
|
option(FORCE_BUNDLED_GTEST "Force the use of bundled gtest" OFF)
|
||||||
|
|
||||||
|
# This is for use with colobot-lint tool
|
||||||
|
option(COLOBOT_LINT_BUILD "Generate some additional CMake targets for use with colobot-lint" OFF)
|
||||||
|
|
||||||
|
|
||||||
# Default build type if not given is debug
|
# Default build type if not given is debug
|
||||||
if(NOT DEFINED CMAKE_BUILD_TYPE)
|
if(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||||
message(STATUS "Build type not specified - assuming debug")
|
message(STATUS "Build type not specified - assuming debug")
|
||||||
|
@ -267,12 +271,12 @@ include("${colobot_SOURCE_DIR}/cmake/mxe.cmake")
|
||||||
##
|
##
|
||||||
include("${colobot_SOURCE_DIR}/cmake/msys.cmake")
|
include("${colobot_SOURCE_DIR}/cmake/msys.cmake")
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Additional settings for colobot-lint
|
# Additional functions for colobot-lint
|
||||||
##
|
##
|
||||||
include("${colobot_SOURCE_DIR}/cmake/colobot-lint.cmake")
|
include("${colobot_SOURCE_DIR}/cmake/colobot-lint.cmake")
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# MSVC specific settings
|
# MSVC specific settings
|
||||||
##
|
##
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
# Some functions for use with colobot-lint
|
# Some functions for use with colobot-lint
|
||||||
|
|
||||||
option(COLOBOT_LINT_BUILD "Enable some additional functions for use with colobot-lint")
|
##
|
||||||
|
# This adds a new target with generated fake source files that include single header files
|
||||||
if(COLOBOT_LINT_BUILD)
|
# It is a workaround for how CMake and Clang handle header files in compilation database
|
||||||
|
# And we need that to check each header file in the project exactly once, the same as .cpp modules
|
||||||
|
##
|
||||||
|
macro(add_fake_header_sources subdir)
|
||||||
set(all_fake_header_src_files "")
|
set(all_fake_header_src_files "")
|
||||||
|
|
||||||
set(fake_headers_src_dir ${colobot_BINARY_DIR}/fake_header_sources)
|
set(fake_headers_src_dir ${colobot_BINARY_DIR}/fake_header_sources)
|
||||||
file(MAKE_DIRECTORY ${fake_headers_src_dir})
|
file(MAKE_DIRECTORY ${fake_headers_src_dir})
|
||||||
|
|
||||||
file(GLOB_RECURSE all_header_files RELATIVE ${colobot_SOURCE_DIR} src/*.h test/*.h)
|
file(GLOB_RECURSE all_header_files RELATIVE ${colobot_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
|
||||||
|
|
||||||
foreach(header_file ${all_header_files})
|
foreach(header_file ${all_header_files})
|
||||||
string(REGEX REPLACE "\\.h$" ".cpp" fake_header_src_file "${fake_headers_src_dir}/${header_file}")
|
string(REGEX REPLACE "\\.h$" ".cpp" fake_header_src_file "${fake_headers_src_dir}/${header_file}")
|
||||||
|
@ -23,6 +25,5 @@ if(COLOBOT_LINT_BUILD)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
include_directories(${colobot_SOURCE_DIR})
|
include_directories(${colobot_SOURCE_DIR})
|
||||||
add_library(colobot_fake_header_srcs STATIC ${all_fake_header_src_files})
|
add_library(colobot_${subdir}_fake_header_srcs STATIC ${all_fake_header_src_files})
|
||||||
|
endmacro()
|
||||||
endif()
|
|
||||||
|
|
|
@ -306,3 +306,7 @@ install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})
|
||||||
if(NOT CBOT_STATIC)
|
if(NOT CBOT_STATIC)
|
||||||
set_target_properties(colobot PROPERTIES INSTALL_RPATH ${COLOBOT_INSTALL_LIB_DIR})
|
set_target_properties(colobot PROPERTIES INSTALL_RPATH ${COLOBOT_INSTALL_LIB_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(COLOBOT_LINT_BUILD)
|
||||||
|
add_fake_header_sources("src")
|
||||||
|
endif()
|
|
@ -11,3 +11,8 @@ add_subdirectory(unit)
|
||||||
|
|
||||||
# Test environments
|
# Test environments
|
||||||
add_subdirectory(envs)
|
add_subdirectory(envs)
|
||||||
|
|
||||||
|
|
||||||
|
if(COLOBOT_LINT_BUILD)
|
||||||
|
add_fake_header_sources("test")
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue