1 cmake_minimum_required(VERSION 3.12...3.31) 2 3 project( 4 iostream_add_subdirectory_exclude 5 LANGUAGES CXX 6 VERSION @iostreamV3_VERSION@) 7 8 option(ZLIB_IOSTREAM3_BUILD_SHARED "" @ZLIB_IOSTREAM3_BUILD_SHARED@) 9 option(ZLIB_IOSTREAM3_BUILD_STATIC "" @ZLIB_IOSTREAM3_BUILD_STATIC@) 10 option(ZLIB_IOSTREAM3_BUILD_TESTING "" OFF) 11 12 add_subdirectory(@iostreamV3_SOURCE_DIR@ 13 ${CMAKE_CURRENT_BINARY_DIR}/iostream3 14 EXCLUDE_FROM_ALL) 15 16 set(IOSTREAM_SRCS 17 @iostreamV3_SOURCE_DIR@/test.cc) 18 19 if(ZLIB_IOSTREAM3_BUILD_SHARED) 20 add_executable(test_example ${IOSTREAM_SRCS}) 21 target_link_libraries(test_example IOSTREAMV3::IOSTREAMV3) 22 endif(ZLIB_IOSTREAM3_BUILD_SHARED) 23 24 if(ZLIB_IOSTREAM3_BUILD_STATIC) 25 add_executable(test_example_static ${IOSTREAM_SRCS}) 26 target_link_libraries(test_example_static IOSTREAMV3::IOSTREAMV3STATIC) 27 endif(ZLIB_IOSTREAM3_BUILD_STATIC) 28