# - AddExecutable # To add an executable # SET(myindent "${myindent}\t") message(STATUS "${myindent}# \"AddExecutable\" included!") if(__AddExecutable_INCLUDED) return() endif() set(__AddExecutable_INCLUDED TRUE) include(AddCommon) #--------------------------------------------------------------------------------------------------- # icedust_add_executable( # source1 source2 ... # LINK_LIBRARIES library1 library2 ... # INCLUDE_DIRS dir1 package2 ...) # # Extension of standard CMake 'add_executable' command. # Create a library from the specified sources (glob patterns are allowed), linking # it with the libraries specified and adding the include directories to the search path. #--------------------------------------------------------------------------------------------------- function(icedust_add_executable executable) message(STATUS "${myindent}==>function(icedust_add_executable ${executable}) (${ARGN})") SET(myindent "${myindent}\t") icedust_common_add_build(${ARGN}) IF(executable) FOREACH(fp ${ARGN}) FILE(GLOB src ${package_dir}/src/${fp}) LIST(APPEND srcs ${src}) ENDFOREACH() IF(srcs) message(STATUS "${myindent}add_executable(${executable} ${srcs})") add_executable(${executable} ${srcs}) target_link_libraries(${executable} ${ARG_LINK_LIBRARIES}) _icedust_detach_debinfo(${executable}) if (ICEDUST_USE_EXE_SUFFIX) set_target_properties(${executable} PROPERTIES SUFFIX .exe) endif() # icedust_add_genheader_dependencies(${executable}) #----Installation details------------------------------------------------------- install(TARGETS ${executable} EXPORT ${CMAKE_PROJECT_NAME}Exports RUNTIME DESTINATION bin OPTIONAL) install(EXPORT ${CMAKE_PROJECT_NAME}Exports DESTINATION cmake OPTIONAL) # icedust_export(EXECUTABLE ${executable}) ENDIF() ENDIF() string(REGEX REPLACE "(\t*)\t" "\\1" myindent "${myindent}") message(STATUS "${myindent}<==function(icedust_add_executable ${executable}) (${ARGN})") endfunction() string(REGEX REPLACE "(\t*)\t" "\\1" myindent "${myindent}")