Skip to content

Commit

Permalink
Optimize cmakelists
Browse files Browse the repository at this point in the history
  • Loading branch information
resetius committed Dec 9, 2023
1 parent 71cd890 commit 09dced0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ add_library(coroio
coroio/ssl.cpp
)

target_include_directories(coroio PUBLIC ${URING_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS})
target_link_directories(coroio PUBLIC ${URING_LIBRARY_DIRS} ${OPENSSL_LIBRARY_DIRS})
target_link_libraries(coroio PUBLIC ${URING_LIBRARIES} ${OPENSSL_LIBRARIES})

macro(target name source)
add_executable(${name} ${source})
target_include_directories(${name} PRIVATE ${CMOCKA_INCLUDE_DIRS} ${URING_INCLUDE_DIRS})
target_link_directories(${name} PRIVATE ${CMOCKA_LIBRARY_DIRS} ${URING_LIBRARY_DIRS})
target_link_libraries(${name} coroio ${CMOCKA_LIBRARIES} ${URING_LIBRARIES} ${OPENSSL_LIBRARIES})
target_link_libraries(${name} coroio)
endmacro()

macro(ut name source)
add_executable(ut_${name} ${source})
target_include_directories(ut_${name} PRIVATE ${CMOCKA_INCLUDE_DIRS} ${URING_INCLUDE_DIRS})
target_link_directories(ut_${name} PRIVATE ${CMOCKA_LIBRARY_DIRS} ${URING_LIBRARY_DIRS})
target_link_libraries(ut_${name} coroio ${CMOCKA_LIBRARIES} ${URING_LIBRARIES})
target_include_directories(ut_${name} PRIVATE ${CMOCKA_INCLUDE_DIRS})
target_link_directories(ut_${name} PRIVATE ${CMOCKA_LIBRARY_DIRS})
target_link_libraries(ut_${name} PRIVATE coroio ${CMOCKA_LIBRARIES})

add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/ut_${name})
set_tests_properties(${name} PROPERTIES ENVIRONMENT "CMOCKA_MESSAGE_OUTPUT=xml;CMOCKA_XML_FILE=${name}.xml")
Expand Down

0 comments on commit 09dced0

Please sign in to comment.