forked from pu2clr/SI4735
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
51 lines (43 loc) · 1.7 KB
/
CMakeLists.txt
File metadata and controls
51 lines (43 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
cmake_minimum_required(VERSION 3.31)
project(si4735-cpp)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Initialize git submodules found in lib/
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Only update specific submodules, not all
if(EXISTS "${PROJECT_SOURCE_DIR}/.gitmodules")
message(STATUS "Checking git submodules...")
# Check if lib/ submodules need initialization
if(EXISTS "${PROJECT_SOURCE_DIR}/lib" AND IS_DIRECTORY "${PROJECT_SOURCE_DIR}/lib")
file(GLOB lib_subdirs "${PROJECT_SOURCE_DIR}/lib/*")
if(NOT lib_subdirs)
message(STATUS "Initializing lib/ submodules...")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init lib/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT
)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(WARNING "git submodule update for lib/ failed")
endif()
endif()
endif()
endif()
endif()
# Verify lib/ directory has content (only if it exists)
if(EXISTS "${PROJECT_SOURCE_DIR}/lib")
file(GLOB lib_contents "${PROJECT_SOURCE_DIR}/lib/*")
if(NOT lib_contents)
message(WARNING "lib/ directory is empty. Submodule initialization may have failed.")
endif()
endif()
include(lib/cmake-helpers/arduino-cli.cmake)
set(ONDA_CPP ${CMAKE_SOURCE_DIR}/lib/onda/src/cpp)
set(ONDA_ARDUINO ${CMAKE_SOURCE_DIR}/lib/onda/src/arduino)
set(SI4735_CPP ${CMAKE_SOURCE_DIR}/src/cpp)
set(SI4735_ARDUINO ${CMAKE_SOURCE_DIR}/src/arduino)
set(SI4735_TESTS ${CMAKE_SOURCE_DIR}/src/tests)
add_subdirectory("src/cpp")
add_subdirectory("src/arduino")
#add_subdirectory("src/tests")