cmake_minimum_required(VERSION 2.8) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test) # Setup testing enable_testing() find_package(GTest REQUIRED) find_package(GMock REQUIRED) find_program(SHELL bash) include_directories(${Boost_INCLUDE_DIR} ${JSONCPP_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR}) # Add test cpp file add_executable(cmdman_test test/cmdman_test.cpp src/cmdman.cpp src/fileman.cpp src/base64.cpp) target_link_libraries(cmdman_test ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} ${JSONCPP_LIBRARIES} ${GMOCK_LIBRARIES} ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY}) add_executable(cryptotest_gcm test/cryptotest_gcm.c) target_link_libraries(cryptotest_gcm ${OPENSSL_LIBRARIES}) if(NOT DEFINED DAEMONFILEPATH) set(DAEMONFILEPATH "../../daemon/build/files") endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/samplekey1.bin ${CMAKE_BINARY_DIR}/test/samplekey1.bin COPYONLY) add_test(logintest_pos ${SHELL} ${CMAKE_BINARY_DIR}/test/logintest_pos.sh) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/logintest_pos.sh ${CMAKE_BINARY_DIR}/test/logintest_pos.sh COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/logintest_pos.txt ${CMAKE_BINARY_DIR}/test/logintest_pos.txt COPYONLY) add_test(logintest_neg ${SHELL} ${CMAKE_BINARY_DIR}/test/logintest_neg.sh) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/logintest_neg.sh ${CMAKE_BINARY_DIR}/test/logintest_neg.sh COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/logintest_neg.txt ${CMAKE_BINARY_DIR}/test/logintest_neg.txt COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/samplefile.txt ${CMAKE_BINARY_DIR}/test/samplefile.txt COPYONLY) add_test(cryptoput ${SHELL} ${CMAKE_BINARY_DIR}/test/cryptoput.sh ${DAEMONFILEPATH}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/cryptoput.sh ${CMAKE_BINARY_DIR}/test/cryptoput.sh COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/cryptoput.txt ${CMAKE_BINARY_DIR}/test/cryptoput.txt COPYONLY) add_test(cryptoget ${SHELL} ${CMAKE_BINARY_DIR}/test/cryptoget.sh ${DAEMONFILEPATH}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/cryptoget.sh ${CMAKE_BINARY_DIR}/test/cryptoget.sh COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/cryptoget.txt ${CMAKE_BINARY_DIR}/test/cryptoget.txt COPYONLY) add_test( NAME cmdman_test COMMAND cmdman_test )