Skip to content

Commit

Permalink
Prevent source taint, minimize json dep size
Browse files Browse the repository at this point in the history
Added the OpenCV code to prevent corrupting src and polluting repo from here:
https://github.com/opencv/opencv/blob/c96f48e7c91748f896e99f5bf943faf08cd98f0e/CMakeLists.txt#L12

Switched to the JSON cmake specific repo that has a lot of improvements
  • Loading branch information
Samir-Rashid committed Oct 19, 2023
1 parent 48590a3 commit 585f87f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Disable in-source builds to prevent source tree corruption.
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "
FATAL: In-source builds are not allowed.
You should create a separate directory for build files.
")
endif()


set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_COMPILER gcc)
Expand Down
8 changes: 7 additions & 1 deletion deps/json/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
include(FetchContent)

FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz)
# https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
GIT_TAG v3.11.2)

FetchContent_MakeAvailable(json)

0 comments on commit 585f87f

Please sign in to comment.