cmake_minimum_required(VERSION 2.6) if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE) endif() project(subconscious) # Configuration headers set(subconscious_VERSION_MAJOR 0) set(subconscious_VERSION_MINOR 1) configure_file( "${PROJECT_SOURCE_DIR}/src/main/headers/config.h.in" "${PROJECT_SOURCE_DIR}/src/main/headers/config.h" ) # include directories include_directories("${PROJECT_SOURCE_DIR}/src/main/headers") # sources file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "src/main/cpp/*.cpp") # executable set(EXECUTABLE_NAME "subconscious") add_executable(${EXECUTABLE_NAME} ${SOURCES}) # compiler settings if (CMAKE_COMPILER_IS_GNUCC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror") endif () if (MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") endif () # SFML library set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH}) find_package(SFML 2 REQUIRED network audio graphics window system) if (SFML_FOUND) include_directories(${SFML_INCLUDE_DIR}) target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES}) endif () # install target install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin) # CPack packaging include(InstallRequiredSystemLibraries) # set(CPACK_RESOURCES_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") set(CPACK_PACKAGE_VERSION_MAJOR "${subconscious_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${subconscious_VERSION_MINOR}") include(CPack)