Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

66 wiersze
3.2 KiB

  1. # Initialize ######################################################################################
  2. Include ( cotire OPTIONAL RESULT_VARIABLE HAS_COTIRE )
  3. Include ( pedantic OPTIONAL RESULT_VARIABLE HAS_PEDANTIC )
  4. Include ( strip_symbols OPTIONAL RESULT_VARIABLE HAS_STRIP_SYMBOLS )
  5. Message ( WARNING "Please configure the dependencies of this project!" )
  6. Find_Package ( libhelloworld REQUIRED )
  7. # Object Library ##################################################################################
  8. Set ( HELLOWORLD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include )
  9. File ( GLOB_RECURSE HELLOWORLD_HEADER_FILES ${HELLOWORLD_INCLUDE_DIR}/*.h )
  10. File ( GLOB_RECURSE HELLOWORLD_INLINE_FILES ${HELLOWORLD_INCLUDE_DIR}/*.inl )
  11. File ( GLOB_RECURSE HELLOWORLD_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp )
  12. List ( REMOVE_ITEM HELLOWORLD_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp )
  13. Add_Library ( helloworld-objects
  14. OBJECT
  15. ${HELLOWORLD_HEADER_FILES}
  16. ${HELLOWORLD_INLINE_FILES}
  17. ${HELLOWORLD_SOURCE_FILES} )
  18. Target_Include_Directories ( helloworld-objects
  19. PUBLIC
  20. $<BUILD_INTERFACE:${HELLOWORLD_INCLUDE_DIR}>
  21. $<INSTALL_INTERFACE:${HELLOWORLD_INSTALL_DIR_INCLUDE}> )
  22. Target_Link_Libraries ( helloworld-objects
  23. PUBLIC
  24. libhelloworld-shared )
  25. # Executable ######################################################################################
  26. Set ( HELLOWORLD_MAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp )
  27. Add_Executable ( helloworld ${HELLOWORLD_MAIN_FILE} )
  28. Target_Link_Libraries ( helloworld
  29. PUBLIC
  30. helloworld-objects )
  31. # Optimization ####################################################################################
  32. # pedantic
  33. If ( HAS_PEDANTIC )
  34. Pedantic_Apply_Flags_Target ( helloworld-objects ALL )
  35. Pedantic_Apply_Flags_Target ( helloworld ALL )
  36. EndIf ( )
  37. # cotire
  38. If ( HAS_COTIRE )
  39. Cotire ( helloworld-objects )
  40. Cotire ( helloworld )
  41. EndIf ( )
  42. # Install #########################################################################################
  43. # Executable
  44. Install ( TARGETS helloworld
  45. DESTINATION ${HELLOWORLD_INSTALL_DIR_BIN} )
  46. # Debug
  47. If ( HAS_STRIP_SYMBOLS AND NOT HELLOWORLD_NO_STRIP )
  48. Strip_Symbols ( helloworld HELLOWORLD_DBG_FILE )
  49. If ( HELLOWORLD_INSTALL_DEBUG )
  50. Install ( FILES ${HELLOWORLD_DBG_FILE}
  51. DESTINATION ${HELLOWORLD_INSTALL_DIR_LIB} )
  52. EndIf ( )
  53. EndIf ( )