diff --git a/CMakeLists.txt b/CMakeLists.txt index 47f29a6..90a68ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,9 +75,9 @@ find_package(Threads REQUIRED) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) if(WIN32) - find_package(Boost 1.66.0 REQUIRED) + find_package(Boost REQUIRED) else() - find_package(Boost 1.66.0 REQUIRED COMPONENTS system filesystem) + find_package(Boost REQUIRED COMPONENTS system filesystem date_time) endif() if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) @@ -128,20 +128,25 @@ endif() add_subdirectory(webcc) -if(WEBCC_ENABLE_EXAMPLES) +if(WEBCC_ENABLE_AUTOTEST OR WEBCC_ENABLE_EXAMPLES) # For including jsoncpp as "json/json.h". include_directories(${THIRD_PARTY_DIR}/src/jsoncpp) - # REST examples need jsoncpp to parse and create JSON. + add_subdirectory(${THIRD_PARTY_DIR}/src/jsoncpp) +endif() - add_subdirectory(examples) +if(WEBCC_ENABLE_AUTOTEST OR WEBCC_ENABLE_UNITTEST) + add_subdirectory(${THIRD_PARTY_DIR}/src/gtest) endif() if(WEBCC_ENABLE_AUTOTEST) add_subdirectory(autotest) endif() +if(WEBCC_ENABLE_EXAMPLES) + add_subdirectory(examples) +endif() + if(WEBCC_ENABLE_UNITTEST) - add_subdirectory(${THIRD_PARTY_DIR}/src/gtest) add_subdirectory(unittest) endif() diff --git a/autotest/CMakeLists.txt b/autotest/CMakeLists.txt index dd17406..ff416c9 100644 --- a/autotest/CMakeLists.txt +++ b/autotest/CMakeLists.txt @@ -1,4 +1,4 @@ -# Auto test +# Automation test set(AT_SRCS client_autotest.cc @@ -7,22 +7,23 @@ set(AT_SRCS set(AT_TARGET_NAME webcc_autotest) # Common libraries to link. -set(TEST_LIBS webcc ${Boost_LIBRARIES} "${CMAKE_THREAD_LIBS_INIT}") +set(AT_LIBS webcc ${Boost_LIBRARIES} "${CMAKE_THREAD_LIBS_INIT}") if(WEBCC_ENABLE_SSL) - set(TEST_LIBS ${TEST_LIBS} ${OPENSSL_LIBRARIES}) + set(AT_LIBS ${AT_LIBS} ${OPENSSL_LIBRARIES}) endif() if(WIN32) - set(TEST_LIBS ${TEST_LIBS} zlibstatic crypt32) + # TODO: crypt32 should be ssl related. + set(AT_LIBS ${AT_LIBS} zlibstatic crypt32) else() - set(TEST_LIBS ${TEST_LIBS} ${ZLIB_LIBRARIES}) + set(AT_LIBS ${AT_LIBS} ${ZLIB_LIBRARIES}) endif() if(UNIX) # Add `-ldl` for Linux to avoid "undefined reference to `dlopen'". - set(TEST_LIBS ${TEST_LIBS} ${CMAKE_DL_LIBS}) + set(AT_LIBS ${AT_LIBS} ${CMAKE_DL_LIBS}) endif() add_executable(${AT_TARGET_NAME} ${AT_SRCS}) -target_link_libraries(${AT_TARGET_NAME} webcc jsoncpp gtest ${TEST_LIBS}) +target_link_libraries(${AT_TARGET_NAME} webcc jsoncpp gtest ${AT_LIBS}) diff --git a/doc/screenshots/cmake_config_mac.png b/doc/screenshots/cmake_config_mac.png new file mode 100644 index 0000000..9055b4b Binary files /dev/null and b/doc/screenshots/cmake_config_mac.png differ diff --git a/doc/screenshots/cmake_config_mac_openssl.png b/doc/screenshots/cmake_config_mac_openssl.png new file mode 100644 index 0000000..0d79ffe Binary files /dev/null and b/doc/screenshots/cmake_config_mac_openssl.png differ