- set(LIBRARY_NAME error_code)
- unset(OPTION_ENABLE_TEST_CODE CACHE)
- option(OPTION_ENABLE_TEST_CODE "Whether enable test code." OFF)
- message("<=${LIBRARY_NAME}=> OPTION_ENABLE_TEST_CODE: " ${OPTION_ENABLE_TEST_CODE})
- if (OPTION_ENABLE_TEST_CODE)
- set(LIBRARY_TEST_NAME "${LIBRARY_NAME}_test")
- set(LIBRARY_TEST_SOURCE_LIST
- ${CMAKE_CURRENT_LIST_DIR}/test.h
- ${CMAKE_CURRENT_LIST_DIR}/test.cpp
- ${CMAKE_CURRENT_LIST_DIR}/error_code.cpp
- )
- add_executable(${LIBRARY_TEST_NAME} ${LIBRARY_TEST_SOURCE_LIST})
- target_link_libraries(${LIBRARY_TEST_NAME} ${LIBRARY_NAME} )
- endif ()
|