Skip to content

Commit

Permalink
ports/linux/gnu: add cmake for example_build
Browse files Browse the repository at this point in the history
This adds CMake support to build the `sample_threadx` program target.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
  • Loading branch information
yf13 committed Sep 5, 2024
1 parent 485a02f commit 4398acd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ports/linux/gnu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ target_include_directories(${PROJECT_NAME}
${CMAKE_CURRENT_LIST_DIR}/inc
)

target_compile_definitions(${PROJECT_NAME} PUBLIC "-D_GNU_SOURCE -DTX_LINUX_DEBUG_ENABLE")
target_compile_definitions(${PROJECT_NAME} PUBLIC "-D_GNU_SOURCE -DTX_LINUX_DEBUG_ENABLE")

if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/example_build/CMakeLists.txt)
add_subdirectory(example_build)
endif()
15 changes: 15 additions & 0 deletions ports/linux/gnu/example_build/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build sample_threadx program

project(sample_threadx)
set(SRCS sample_threadx.c)

add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE ${SRCS})
set_target_properties(
${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/../../../../)
target_include_directories(
${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../inc
${CMAKE_CURRENT_LIST_DIR}/../../../../common/inc)

target_link_libraries(${PROJECT_NAME} PRIVATE threadx)

0 comments on commit 4398acd

Please sign in to comment.