From b3ba7d1e87915f432995711a40d8b56c7c54b265 Mon Sep 17 00:00:00 2001 From: FiveDimensions Date: Tue, 12 May 2020 15:39:31 +0800 Subject: [PATCH] align posix cmake format --- src/posix/CMakeLists.txt | 4 +-- src/posix/cli.cmake | 37 +++++++++++++++++++------- src/posix/daemon.cmake | 43 ++++++++++++++----------------- src/posix/platform/CMakeLists.txt | 31 +++++++++++----------- 4 files changed, 65 insertions(+), 50 deletions(-) diff --git a/src/posix/CMakeLists.txt b/src/posix/CMakeLists.txt index 64f8b0abf24..523872031dd 100644 --- a/src/posix/CMakeLists.txt +++ b/src/posix/CMakeLists.txt @@ -29,9 +29,9 @@ set(COMMON_INCLUDES ${OT_PUBLIC_INCLUDES} ${OT_PRIVATE_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR}/platform + ${CMAKE_CURRENT_SOURCE_DIR}/platform/include ${PROJECT_SOURCE_DIR}/src/core - ${PROJECT_SOURCE_DIR}/src/posix/platform - ${PROJECT_SOURCE_DIR}/src/posix/platform/include ) set(OT_READLINE "readline" CACHE STRING "set readline library name") diff --git a/src/posix/cli.cmake b/src/posix/cli.cmake index 86d659987ab..bec08eb04f0 100644 --- a/src/posix/cli.cmake +++ b/src/posix/cli.cmake @@ -31,8 +31,7 @@ add_executable(ot-cli $<$:console_cli.cpp> ) -set_target_properties( - ot-cli +set_target_properties(ot-cli PROPERTIES C_STANDARD 99 CXX_STANDARD 11 @@ -40,15 +39,14 @@ set_target_properties( target_include_directories(ot-cli PRIVATE ${COMMON_INCLUDES}) -target_compile_definitions(ot-cli PRIVATE - $<$:HAVE_LIB$=1> - OPENTHREAD_POSIX_APP_TYPE=OT_POSIX_APP_TYPE_CLI - ${OT_PLATFORM_DEFINES} +target_compile_definitions(ot-cli + PRIVATE + $<$:HAVE_LIB$=1> + OPENTHREAD_POSIX_APP_TYPE=OT_POSIX_APP_TYPE_CLI + ${OT_PLATFORM_DEFINES} ) -target_compile_options(ot-cli PRIVATE - ${OT_CFLAGS} -) +target_compile_options(ot-cli PRIVATE ${OT_CFLAGS}) target_link_libraries(ot-cli openthread-cli-ftd @@ -62,6 +60,27 @@ target_link_libraries(ot-cli ${READLINE_LINK_LIBRARIES} ) +add_executable(ot-ncp + main.c +) + +set_target_properties(ot-ncp + PROPERTIES + C_STANDARD 99 + CXX_STANDARD 11 +) + +target_include_directories(ot-ncp PRIVATE ${COMMON_INCLUDES}) + +target_compile_definitions(ot-ncp + PRIVATE + OPENTHREAD_POSIX_APP_TYPE=OT_POSIX_APP_TYPE_NCP + ${OT_PLATFORM_DEFINES} +) + +target_compile_options(ot-ncp PRIVATE ${OT_CFLAGS}) +>>>>>>> 52eb81202... align posix cmake format:src/posix/standalone.cmake + install(TARGETS ot-cli DESTINATION bin) diff --git a/src/posix/daemon.cmake b/src/posix/daemon.cmake index ae41e587739..6398f7b45c2 100644 --- a/src/posix/daemon.cmake +++ b/src/posix/daemon.cmake @@ -30,8 +30,7 @@ add_executable(ot-daemon main.c ) -set_target_properties( - ot-daemon +set_target_properties(ot-daemon PROPERTIES C_STANDARD 99 CXX_STANDARD 11 @@ -39,43 +38,41 @@ set_target_properties( target_include_directories(ot-daemon PRIVATE ${COMMON_INCLUDES}) -target_compile_definitions(ot-daemon PRIVATE - OPENTHREAD_POSIX_APP_TYPE=OT_POSIX_APP_TYPE_CLI - ${OT_PLATFORM_DEFINES} +target_compile_definitions(ot-daemon + PRIVATE + OPENTHREAD_POSIX_APP_TYPE=OT_POSIX_APP_TYPE_CLI + ${OT_PLATFORM_DEFINES} ) -target_compile_options(ot-daemon PRIVATE - ${OT_CFLAGS} -) +target_compile_options(ot-daemon PRIVATE ${OT_CFLAGS}) -target_link_libraries(ot-daemon PRIVATE - openthread-cli-ftd - ${OT_PLATFORM_LIB} - openthread-ftd - ${OT_PLATFORM_LIB} - openthread-ncp-ftd - mbedcrypto +target_link_libraries(ot-daemon + PRIVATE + openthread-cli-ftd + ${OT_PLATFORM_LIB} + openthread-ftd + ${OT_PLATFORM_LIB} + openthread-ncp-ftd + mbedcrypto ) add_executable(ot-ctl client.cpp ) -set_target_properties( - ot-ctl +set_target_properties(ot-ctl PROPERTIES C_STANDARD 99 CXX_STANDARD 11 ) -target_compile_definitions(ot-ctl PRIVATE - $<$:HAVE_LIB$=1> - ${OT_PLATFORM_DEFINES} +target_compile_definitions(ot-ctl + PRIVATE + $<$:HAVE_LIB$=1> + ${OT_PLATFORM_DEFINES} ) -target_compile_options(ot-ctl PRIVATE - ${OT_CFLAGS} -) +target_compile_options(ot-ctl PRIVATE ${OT_CFLAGS}) target_link_libraries(ot-ctl openthread-platform diff --git a/src/posix/platform/CMakeLists.txt b/src/posix/platform/CMakeLists.txt index bb6aa34bf29..e73092d42b4 100644 --- a/src/posix/platform/CMakeLists.txt +++ b/src/posix/platform/CMakeLists.txt @@ -75,17 +75,17 @@ add_library(openthread-posix virtual_time.cpp ) -set_target_properties( - openthread-posix +set_target_properties(openthread-posix PROPERTIES C_STANDARD 99 CXX_STANDARD 11 ) -target_link_libraries(openthread-posix PUBLIC - openthread-platform - ot-config - util +target_link_libraries(openthread-posix + PUBLIC + openthread-platform + ot-config + util ) target_compile_definitions(openthread-posix @@ -95,16 +95,15 @@ target_compile_definitions(openthread-posix ${OT_PLATFORM_DEFINES} ) -target_compile_options(openthread-posix PRIVATE - ${OT_CFLAGS} -) +target_compile_options(openthread-posix PRIVATE ${OT_CFLAGS}) -target_include_directories(openthread-posix PRIVATE - ${OT_PUBLIC_INCLUDES} - ${OT_PRIVATE_INCLUDES} - ${PROJECT_SOURCE_DIR}/src - ${PROJECT_SOURCE_DIR}/src/core - ${PROJECT_SOURCE_DIR}/third_party/mbedtls/repo/include +target_include_directories(openthread-posix PUBLIC - ${PROJECT_SOURCE_DIR}/src/posix/platform/include + ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE + ${OT_PUBLIC_INCLUDES} + ${OT_PRIVATE_INCLUDES} + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_SOURCE_DIR}/src/core + ${PROJECT_SOURCE_DIR}/third_party/mbedtls/repo/include )