template_find_program.cmake 1.37 KB
Newer Older
Pierre Aubert's avatar
Pierre Aubert committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
##########################################################################
#                                                                        #
#          test de présence du programme de @PROJECT_NAME_UPPER@         #
#                                                                        #
##########################################################################

@PHOENIX_PACKAGE_PEDENDENCIES@

if(@PROJECT_NAME_UPPER@_FOUND)
	@EXTRA_INCLUDE_CMAKE@
	return()
endif()

#Find the program
find_path(@PROJECT_NAME_UPPER@_EXECUTABLE_DIR
	NAMES @programTargetName@
	PATHS "${@PROJECT_NAME_UPPER@_PREFIX}/bin" ${CMAKE_INSTALL_PREFIX}/bin $ENV{HOME}/usr/bin ${CMAKE_INCLUDE_PATH}/bin /usr/bin /usr/local/bin /bin
)

if(@PROJECT_NAME_UPPER@_EXECUTABLE_DIR)
	message(STATUS "Found program @PROJECT_NAME_UPPER@ : ${@PROJECT_NAME_UPPER@_EXECUTABLE_DIR}")
	set(@PROJECT_NAME_UPPER@_EXECUTABLE_DIR "${@PROJECT_NAME_UPPER@_EXECUTABLE_DIR}" CACHE STRING "@PROJECT_NAME_UPPER@ program directory")
	set(@PROJECT_NAME_UPPER@_EXECUTABLE "${@PROJECT_NAME_UPPER@_EXECUTABLE_DIR}/@programTargetName@" CACHE STRING "@PROJECT_NAME_UPPER@ program")
else(@PROJECT_NAME_UPPER@_EXECUTABLE_DIR)
	message(FATAL_ERROR "program @PROJECT_NAME_UPPER@ not found")
endif(@PROJECT_NAME_UPPER@_EXECUTABLE_DIR)

set(@PROJECT_NAME_UPPER@_FOUND "YES" CACHE BOOL "@PROJECT_NAME_UPPER@ project found")

@EXTRA_INCLUDE_CMAKE@