pikapython/test/CMakeLists.txt

25 lines
693 B
CMake
Raw Normal View History

2022-10-28 16:02:36 +08:00
# include(CheckIPOSupported)
# check_ipo_supported(RESULT supported OUTPUT error)
2021-10-01 00:21:50 +08:00
set(BINARY ${CMAKE_PROJECT_NAME}_test)
file(GLOB_RECURSE TEST_SOURCES LIST_DIRECTORIES false *.h *.cpp *.c)
set(SOURCES ${TEST_SOURCES})
2022-10-28 16:02:36 +08:00
2021-10-01 00:21:50 +08:00
add_executable(${BINARY} ${TEST_SOURCES})
add_test(NAME ${BINARY} COMMAND ${BINARY})
2021-10-12 22:03:55 +08:00
2022-10-28 16:02:36 +08:00
# if(supported)
# message(STATUS "IPO / LTO enabled")
# set_property(TARGET ${BINARY} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
# else()
# message(STATUS "IPO / LTO not supported: <${error}>")
# endif()
2021-10-12 22:03:55 +08:00
2021-10-01 00:21:50 +08:00
# 链接src生成的lib库和gtest库
target_link_libraries(${BINARY} PUBLIC
2021-10-12 22:03:55 +08:00
-Wl,--whole-archive ${CMAKE_PROJECT_NAME}-core -Wl,--no-whole-archive
2021-10-01 00:21:50 +08:00
gtest)