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.
 
 
 
 

70 lines
3.5 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. If ( HAS_PEDANTIC )
  6. Pedantic_Apply_Flags ( ALL )
  7. EndIf ( )
  8. Option ( HELLOWORLD_INSTALL_DEBUG
  9. "Install the stripped debug informations of helloworld."
  10. OFF )
  11. Option ( HELLOWORLD_NO_STRIP
  12. "Do not strip debug symbols from binary."
  13. OFF )
  14. Message ( WARNING "Please configure the dependencies of this project!" )
  15. Find_Package ( libhelloworld REQUIRED )
  16. # Object Library ##################################################################################
  17. Set ( HELLOWORLD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include )
  18. File ( GLOB_RECURSE HELLOWORLD_HEADER_FILES ${HELLOWORLD_INCLUDE_DIR}/*.h )
  19. File ( GLOB_RECURSE HELLOWORLD_INLINE_FILES ${HELLOWORLD_INCLUDE_DIR}/*.inl )
  20. File ( GLOB_RECURSE HELLOWORLD_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp )
  21. List ( REMOVE_ITEM HELLOWORLD_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp )
  22. Add_Library ( helloworld-objects
  23. OBJECT
  24. ${HELLOWORLD_HEADER_FILES}
  25. ${HELLOWORLD_INLINE_FILES}
  26. ${HELLOWORLD_SOURCE_FILES} )
  27. Target_Include_Directories ( helloworld-objects
  28. PUBLIC
  29. $<BUILD_INTERFACE:${HELLOWORLD_INCLUDE_DIR}>
  30. $<INSTALL_INTERFACE:${HELLOWORLD_INSTALL_DIR_INCLUDE}> )
  31. Target_Link_Libraries ( helloworld-objects
  32. PUBLIC
  33. libhelloworld-shared )
  34. # Executable ######################################################################################
  35. Set ( HELLOWORLD_MAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp )
  36. Add_Executable ( helloworld ${HELLOWORLD_MAIN_FILE} )
  37. Target_Link_Libraries ( helloworld
  38. PUBLIC
  39. helloworld-objects )
  40. # Optimization ####################################################################################
  41. If ( HAS_COTIRE )
  42. Cotire ( helloworld-objects )
  43. Cotire ( helloworld )
  44. EndIf ( )
  45. # Install #########################################################################################
  46. # Executable
  47. Install ( TARGETS helloworld
  48. DESTINATION ${HELLOWORLD_INSTALL_DIR_BIN} )
  49. # Debug
  50. If ( HAS_STRIP_SYMBOLS AND NOT HELLOWORLD_NO_STRIP )
  51. Strip_Symbols ( helloworld HELLOWORLD_DBG_FILE )
  52. If ( HELLOWORLD_INSTALL_DEBUG )
  53. Install ( FILES ${HELLOWORLD_DBG_FILE}
  54. DESTINATION ${HELLOWORLD_INSTALL_DIR_LIB} )
  55. EndIf ( )
  56. EndIf ( )