Skip to content

Commit df9748c

Browse files
committed
testing/cxx-oot-build: Exclude cxx-oot-build in CMake projects.
Remove the previous guard logic and use a proper CMake `exclude` rule to prevent `cxx-oot-build` from being included when building projects with CMake. * Ensures OOT test project is not pulled into normal apps. * Keeps CI and export tests isolated from regular builds. Signed-off-by: trns1997 <[email protected]>
1 parent 3684699 commit df9748c

File tree

2 files changed

+20
-28
lines changed

2 files changed

+20
-28
lines changed

testing/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
#
2121
# ##############################################################################
2222

23-
nuttx_add_subdirectory()
23+
nuttx_add_subdirectory(EXCLUDE cxx-oot-build)
2424
nuttx_generate_kconfig(MENUDESC "Testing")

testing/cxx-oot-build/CMakeLists.txt

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,29 @@
2222

2323
cmake_minimum_required(VERSION 3.12...3.31)
2424

25-
# --- Guard option ---
26-
option(BUILD_OOTCPP "Build the Out Of Tree C++ project" OFF)
25+
project(
26+
OOTCpp
27+
VERSION 1.0
28+
DESCRIPTION "Out Of Tree Build C++ NuttX")
2729

28-
if(BUILD_OOTCPP)
29-
project(
30-
OOTCpp
31-
VERSION 1.0
32-
DESCRIPTION "Out Of Tree Build C++ NuttX")
30+
message(STATUS "Building OOTCpp project")
3331

34-
message(STATUS "Building OOTCpp project")
32+
set(CMAKE_CXX_STANDARD 17)
33+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3534

36-
set(CMAKE_CXX_STANDARD 17)
37-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
35+
set(SOURCE_FILES ${CMAKE_SOURCE_DIR}/src/HelloWorld.cpp
36+
${CMAKE_SOURCE_DIR}/src/main.cpp)
3837

39-
set(SOURCE_FILES ${CMAKE_SOURCE_DIR}/src/HelloWorld.cpp
40-
${CMAKE_SOURCE_DIR}/src/main.cpp)
38+
set(EXE_NAME oot)
4139

42-
set(EXE_NAME oot)
40+
add_executable(${EXE_NAME} ${SOURCE_FILES})
4341

44-
add_executable(${EXE_NAME} ${SOURCE_FILES})
42+
target_include_directories(${EXE_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include)
4543

46-
target_include_directories(${EXE_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include)
47-
48-
# Generate a .bin file from the ELF after build
49-
add_custom_command(
50-
TARGET ${EXE_NAME}
51-
POST_BUILD
52-
COMMAND ${CMAKE_OBJCOPY} -S -O binary ${CMAKE_BINARY_DIR}/${EXE_NAME}
53-
${CMAKE_BINARY_DIR}/${EXE_NAME}.bin
54-
COMMENT "Generating binary image ${EXE_NAME}.bin")
55-
56-
else()
57-
message(STATUS "Skipping OOTCpp project")
58-
endif()
44+
# Generate a .bin file from the ELF after build
45+
add_custom_command(
46+
TARGET ${EXE_NAME}
47+
POST_BUILD
48+
COMMAND ${CMAKE_OBJCOPY} -S -O binary ${CMAKE_BINARY_DIR}/${EXE_NAME}
49+
${CMAKE_BINARY_DIR}/${EXE_NAME}.bin
50+
COMMENT "Generating binary image ${EXE_NAME}.bin")

0 commit comments

Comments
 (0)