aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-12-04 10:20:23 -0500
committerRaghuram Subramani <raghus2247@gmail.com>2025-12-04 10:20:23 -0500
commitc39cc319394993299874c135564d7675a2c5da45 (patch)
tree3763055cb549342f09eccdd0dbb8e11331021f01 /CMakeLists.txt
parent62cbce9e51781c93822e2ad4eb9a4a54e996e432 (diff)
discount: fix nix buildHEADmain
Nix doesn't allow network requests while building, so the source for discount needs to be fetched before the build is initiated.
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt24
1 files changed, 16 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5d6b44..131f872 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,15 +1,23 @@
cmake_minimum_required(VERSION 3.21)
include(FetchContent)
-FetchContent_Declare(
- discount
- GIT_REPOSITORY "https://github.com/Orc/discount"
- GIT_TAG "main"
- SOURCE_DIR "discount"
-)
-FetchContent_MakeAvailable(discount)
-add_subdirectory(${discount_SOURCE_DIR}/cmake)
+if (DEFINED DISCOUNT_SRC)
+ FetchContent_Declare(
+ discount
+ SOURCE_DIR "${DISCOUNT_SRC}"
+ )
+else ()
+ FetchContent_Declare(
+ discount
+ GIT_REPOSITORY "https://github.com/Orc/discount.git"
+ GIT_TAG "main"
+ SOURCE_DIR "discount"
+ )
+endif()
+
+FetchContent_MakeAvailable(discount)
+add_subdirectory(${discount_SOURCE_DIR}/cmake discount)
project(msg C)