CMakeLists.txt 992 B

123456789101112131415161718192021222324252627282930
  1. enable_testing()
  2. find_package(GTest REQUIRED)
  3. list(REMOVE_ITEM SOURCE_FILES ${PROJECT_SOURCE_DIR}/src/main.cpp)
  4. list(REMOVE_ITEM CPP3DS_EMU_LIBS cpp3ds-emu)
  5. set(TEST_SOURCE_FILES
  6. ${PROJECT_SOURCE_DIR}/test/main.cpp
  7. )
  8. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  9. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
  10. include_directories(
  11. ${PROJECT_SOURCE_DIR}/include
  12. ${CPP3DS}/include
  13. ${GTEST_INCLUDE_DIRS}
  14. )
  15. link_directories(
  16. ${CPP3DS}/lib
  17. )
  18. add_executable(${PROJECT_NAME}-tests ${TEST_SOURCE_FILES} ${SOURCE_FILES} ${EMU_SOURCE_FILES})
  19. target_link_libraries(${PROJECT_NAME}-tests ${GTEST_BOTH_LIBRARIES} cpp3ds-test ${CPP3DS_EMU_LIBS})
  20. set_target_properties(${PROJECT_NAME}-tests PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${TEST_FLAGS} -std=c++11")
  21. set_target_properties(${PROJECT_NAME}-tests PROPERTIES COMPILE_DEFINITIONS "EMULATION;TEST")
  22. set_target_properties(${PROJECT_NAME}-tests PROPERTIES LINK_FLAGS "${CMAKE_CXX_FLAGS} ${TEST_FLAGS}")