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.
 
 
 
 

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