# Initialize ###################################################################################### Include ( cotire OPTIONAL RESULT_VARIABLE HAS_COTIRE ) Include ( pedantic OPTIONAL RESULT_VARIABLE HAS_PEDANTIC ) Include ( strip_symbols OPTIONAL RESULT_VARIABLE HAS_STRIP_SYMBOLS ) Find_Package ( Sanitizers QUIET ) Message ( WARNING "Please configure the dependencies of this project!" ) Find_Package ( libhelloworld REQUIRED ) # Object Library ################################################################################## Set ( HELLOWORLD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include ) File ( GLOB_RECURSE HELLOWORLD_HEADER_FILES ${HELLOWORLD_INCLUDE_DIR}/*.h ) File ( GLOB_RECURSE HELLOWORLD_INLINE_FILES ${HELLOWORLD_INCLUDE_DIR}/*.inl ) File ( GLOB_RECURSE HELLOWORLD_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) List ( REMOVE_ITEM HELLOWORLD_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) Add_Library ( helloworld-objects OBJECT ${HELLOWORLD_HEADER_FILES} ${HELLOWORLD_INLINE_FILES} ${HELLOWORLD_SOURCE_FILES} ) Target_Include_Directories ( helloworld-objects PUBLIC $ $ ) Target_Link_Libraries ( helloworld-objects PUBLIC libhelloworld-shared ) # Executable ###################################################################################### Set ( HELLOWORLD_MAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) Add_Executable ( helloworld ${HELLOWORLD_MAIN_FILE} ) Target_Link_Libraries ( helloworld PUBLIC helloworld-objects ) # Optimization #################################################################################### # sanitizers If ( Sanitizers_FOUND ) Add_Sanitizers ( helloworld-objects ) Add_Sanitizers ( helloworld ) EndIf ( ) # pedantic If ( HAS_PEDANTIC ) Pedantic_Apply_Flags_Target ( helloworld-objects ALL ) Pedantic_Apply_Flags_Target ( helloworld ALL ) EndIf ( ) # cotire If ( HAS_COTIRE ) Cotire ( helloworld-objects ) Cotire ( helloworld ) EndIf ( ) # Install ######################################################################################### # Executable Install ( TARGETS helloworld DESTINATION ${HELLOWORLD_INSTALL_DIR_BIN} ) # Debug If ( HAS_STRIP_SYMBOLS AND NOT HELLOWORLD_NO_STRIP ) Strip_Symbols ( helloworld HELLOWORLD_DBG_FILE ) If ( HELLOWORLD_INSTALL_DEBUG ) Install ( FILES ${HELLOWORLD_DBG_FILE} DESTINATION ${HELLOWORLD_INSTALL_DIR_LIB} ) EndIf ( ) EndIf ( )