No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. cmake_minimum_required(VERSION 2.6)
  2. project(otclient)
  3. set(VERSION "0.6.0")
  4. set(FRAMEWORK_SOUND ON)
  5. set(FRAMEWORK_GRAPHICS ON)
  6. set(FRAMEWORK_XML ON)
  7. set(FRAMEWORK_NET ON)
  8. include(src/framework/CMakeLists.txt)
  9. include(src/client/CMakeLists.txt)
  10. # functions map for reading backtraces
  11. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-Map=${PROJECT_NAME}.map")
  12. option(USE_PCH "Use precompiled header (speed up compile)" OFF)
  13. set(executable_SOURCES
  14. src/main.cpp
  15. )
  16. # add executable icon for win32 platforms
  17. if(WIN32)
  18. add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o
  19. COMMAND ${CMAKE_RC_COMPILER}
  20. -I${CMAKE_CURRENT_SOURCE_DIR}/src
  21. -i${CMAKE_CURRENT_SOURCE_DIR}/src/otcicon.rc
  22. -o ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o)
  23. set(executable_SOURCES ${executable_SOURCES} otcicon.o)
  24. endif()
  25. add_definitions(-D"VERSION=\\"${VERSION}\\"")
  26. # add client executable
  27. add_executable(${PROJECT_NAME} ${framework_SOURCES} ${client_SOURCES} ${executable_SOURCES})
  28. # target link libraries
  29. target_link_libraries(${PROJECT_NAME} ${framework_LIBRARIES})
  30. if(USE_PCH)
  31. include(cotire)
  32. cotire(${PROJECT_NAME})
  33. message(STATUS "Use precompiled header: ON")
  34. else()
  35. message(STATUS "Use precompiled header: OFF")
  36. endif()
  37. # installation
  38. set(DATA_INSTALL_DIR share/${PROJECT_NAME})
  39. install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
  40. install(FILES README.md BUGS LICENSE AUTHORS init.lua ${PROJECT_NAME}rc.lua DESTINATION ${DATA_INSTALL_DIR})
  41. install(DIRECTORY data modules DESTINATION ${DATA_INSTALL_DIR} PATTERN ".git" EXCLUDE)
  42. # add "make run"
  43. add_custom_target(run COMMAND ${PROJECT_NAME} DEPENDS ${PROJECT_NAME} WORKING_DIRECTORY ${CMAKE_PROJECT_DIR})