Skip to content

Commit

Permalink
Make SYSTEM argument optional
Browse files Browse the repository at this point in the history
Fix bug when include directories hidden from clang-cl & cmake-fetch-content
  • Loading branch information
KOMMYHAP committed Jun 2, 2024
1 parent a7f443b commit d175af9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions googletest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ option(
"Build gtest with internal symbols hidden in shared libraries."
OFF)

option(gtest_enable_system_include "Whether or not gtest should be considered a system include." ON)

# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
include(cmake/hermetic_build.cmake OPTIONAL)

Expand Down Expand Up @@ -141,10 +143,13 @@ endif()
cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
set_target_properties(gtest_main PROPERTIES VERSION ${GOOGLETEST_VERSION})
string(REPLACE ";" "$<SEMICOLON>" dirs "${gtest_build_include_dirs}")
target_include_directories(gtest SYSTEM INTERFACE
if (gtest_enable_system_include)
set(gtest_system_include SYSTEM)
endif()
target_include_directories(gtest ${gtest_system_include} INTERFACE
"$<BUILD_INTERFACE:${dirs}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
target_include_directories(gtest_main SYSTEM INTERFACE
target_include_directories(gtest_main ${gtest_system_include} INTERFACE
"$<BUILD_INTERFACE:${dirs}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
if(CMAKE_SYSTEM_NAME MATCHES "QNX" AND CMAKE_SYSTEM_VERSION VERSION_GREATER_EQUAL 7.1)
Expand Down

0 comments on commit d175af9

Please sign in to comment.