Skip to content

Commit

Permalink
Merge pull request #631 from laurynas-biveinis/gsl-cmake
Browse files Browse the repository at this point in the history
 Handle GSL dependency as a full CMake subdirectory instead of a C++ include dir
  • Loading branch information
laurynas-biveinis authored Jan 12, 2025
2 parents ae50e75 + 69a83e4 commit f896f77
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ else()
set(USE_BOOST_STACKTRACE OFF)
endif()

add_subdirectory(3rd_party/GSL)

string(REPLACE ";" " " CXX_FLAGS_FOR_SUBDIR_STR "${SANITIZER_CXX_FLAGS}")
if(MSVC)
string(REPLACE ";" " " MSVC_WARNING_FLAGS_FOR_SUBDIR_STR_TMP "${MSVC_CXX_WARNING_FLAGS}")
Expand Down Expand Up @@ -601,7 +603,6 @@ if(IWYU OR MAINTAINER_MODE)
endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(GSL_INCLUDES "3rd_party/GSL/include")

function(COMMON_TARGET_PROPERTIES TARGET)
cmake_parse_arguments(PARSE_ARGV 1 CTP "SKIP_CHECKS" "" "")
Expand Down Expand Up @@ -681,14 +682,14 @@ endfunction()
function(ADD_UNODB_LIBRARY LIB)
add_library(${LIB} ${ARGN})
common_target_properties(${LIB})
target_include_directories(${LIB} SYSTEM PUBLIC "${GSL_INCLUDES}")
target_link_libraries(${LIB} PUBLIC Microsoft.GSL::GSL)
set_clang_tidy_options(${LIB} "${DO_CLANG_TIDY}")

if(LIBFUZZER_AVAILABLE)
set(LIB_LF "${LIB}_lf")
add_library(${LIB_LF} ${ARGN})
common_target_properties(${LIB_LF} SKIP_CHECKS)
target_include_directories(${LIB_LF} SYSTEM PUBLIC "${GSL_INCLUDES}")
target_link_libraries(${LIB_LF} PUBLIC Microsoft.GSL::GSL)
target_compile_options(${LIB_LF} PRIVATE "-fsanitize=fuzzer-no-link")
endif()
endfunction()
Expand Down

0 comments on commit f896f77

Please sign in to comment.