summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Radermacher <dominic@familie-radermacher.ch>2022-11-13 14:36:04 +0100
committerDominic Radermacher <dominic@familie-radermacher.ch>2022-11-13 14:36:04 +0100
commit0443d24bdc893af0f8470fa9442f489e3cdd3945 (patch)
tree913b89a9986a25c2b32fa54325c1e9da5e42e071
parentebb7bf22b8997774491389e0655e966df5874b7c (diff)
disable in-source builds
-rw-r--r--CMakeLists.txt18
1 files changed, 13 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f46e1b2..80633cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,12 +1,23 @@
cmake_minimum_required(VERSION 3.16)
+set(CMAKE_DISABLE_SOURCE_CHANGES ON)
+set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
+
+# This needs to come before project() to skip the compiler config process
+if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
+ message(FATAL_ERROR "In-source builds are disabled.
+Please create a subfolder and use `cmake ..` inside it.
+NOTE: cmake will now create CMakeCache.txt and CMakeFiles/*.
+You must delete them, or cmake will refuse to work.")
+endif() # yes, end-markers and even else() need empty parentheses
+
project(lan951x-led-ctl LANGUAGES C)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(CMAKE_INSTALL_PREFIX /usr)
-set(CMAKE_CXX_STANDARD 17)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
@@ -39,9 +50,6 @@ add_dependencies(${PROJECT_NAME}
git-version
)
-add_compile_definitions(
-)
-
target_compile_options(${PROJECT_NAME} PUBLIC
-g
-Os