CMakeLists.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. cmake_minimum_required(VERSION 3.5)
  2. set(CMAKE_CXX_STANDARD 14)
  3. set(CMAKE_BUILD_TYPE Debug)
  4. project(blocky)
  5. file(GLOB_RECURSE blocky_SOURCES "src/*.cpp")
  6. file(GLOB_RECURSE blocky_HEADERS "src/*.hpp")
  7. file(GLOB_RECURSE blocky_TEST "test/test.cpp")
  8. if (MSVC)
  9. # according to the organization in the file systems
  10. macro(GroupSources curdir)
  11. file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir}
  12. ${PROJECT_SOURCE_DIR}/${curdir}/*)
  13. foreach(child ${children})
  14. if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
  15. GroupSources(${curdir}/${child})
  16. else()
  17. string(REPLACE "/" "\\" groupname ${curdir})
  18. source_group(${groupname} FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
  19. endif()
  20. endforeach()
  21. endmacro()
  22. GroupSources(src)
  23. endif(MSVC)
  24. set(blocky_TESTING_SOURCES ${blocky_SOURCES})
  25. list(REMOVE_ITEM blocky_TESTING_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
  26. file(COPY resources DESTINATION .)
  27. find_package(LibLZMA REQUIRED)
  28. include_directories(${LIBLZMA_INCLUDE_DIR})
  29. set(LIBS ${LIBS} ${LIBLZMA_LIBRARIES})
  30. add_executable(blocky ${blocky_SOURCES} ${blocky_HEADERS})
  31. target_link_libraries(blocky ${LIBS})
  32. #add_executable(blocky_test ${blocky_TEST} ${blocky_TESTING_SOURCES})