template_find_project.cmake 2.43 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 36 37 38 39 40 41 42 43 44 45 46 47

##########################################################################
#                                                                        #
#         test de présence des headers de la @PROJECT_NAME_UPPER@        #
#                                                                        #
##########################################################################

@PHOENIX_PACKAGE_PEDENDENCIES@

find_path(@PROJECT_NAME_UPPER@_INCLUDE_DIR
	NAMES @headerFile@
	PATHS "${@PROJECT_NAME_UPPER@_PREFIX}/include/@projectName@" ${CMAKE_INSTALL_PREFIX}/include/@projectName@
		$ENV{HOME}/usr/include/@projectName@ ${CMAKE_INCLUDE_PATH}/@projectName@ /usr/include/@projectName@ /usr/local/include/@projectName@ 
)

if(@PROJECT_NAME_UPPER@_INCLUDE_DIR)
	message(STATUS "Found @PROJECT_NAME_UPPER@ headers : ${@PROJECT_NAME_UPPER@_INCLUDE_DIR}")
else(@PROJECT_NAME_UPPER@_INCLUDE_DIR)
	message(FATAL_ERROR "@PROJECT_NAME_UPPER@ headers not found")
endif(@PROJECT_NAME_UPPER@_INCLUDE_DIR)

include_directories(${@PROJECT_NAME_UPPER@_INCLUDE_DIR})

##########################################################################
#                                                                        #
#                  test de présence de la @PROJECT_NAME_UPPER@           #
#                                                                        #
##########################################################################

set(LIBRARY_NAME "lib@libraryTargetName@.so")
if(APPLE)
	set(LIBRARY_NAME "lib@libraryTargetName@.dylib")
endif()

find_path(@PROJECT_NAME_UPPER@_LIBRARY_DIR
	NAMES ${LIBRARY_NAME}
	PATHS "${@PROJECT_NAME_UPPER@_PREFIX}/lib" ${CMAKE_INSTALL_PREFIX}/lib $ENV{HOME}/usr/lib ${CMAKE_INCLUDE_PATH}/lib /usr/lib /usr/local/lib /lib
)

if(@PROJECT_NAME_UPPER@_LIBRARY_DIR)
	message(STATUS "Found lib @PROJECT_NAME_UPPER@ : ${@PROJECT_NAME_UPPER@_LIBRARY_DIR}")
else(@PROJECT_NAME_UPPER@_LIBRARY_DIR)
	message(FATAL_ERROR "lib @PROJECT_NAME_UPPER@ not found")
endif(@PROJECT_NAME_UPPER@_LIBRARY_DIR)

set(@PROJECT_NAME_UPPER@_PREFIX "${@PROJECT_NAME_UPPER@_LIBRARY_DIR}/..")

Pierre Aubert's avatar
Pierre Aubert committed
48
set(@PROJECT_NAME_UPPER@ @libraryTargetName@ @EXTRA_DEPENDENCIES_LIB@ CACHE BOOL "@PROJECT_NAME_UPPER@ library and dependencies")
Pierre Aubert's avatar
Pierre Aubert committed
49

Pierre Aubert's avatar
Pierre Aubert committed
50
set(@PROJECT_NAME_UPPER@_FOUND "YES" CACHE BOOL "@PROJECT_NAME_UPPER@ progect found")
Pierre Aubert's avatar
Pierre Aubert committed
51 52 53 54 55 56

link_directories(${@PROJECT_NAME_UPPER@_LIBRARY_DIR})
include_directories(${@PROJECT_NAME_UPPER@_INCLUDE_DIR} ${@PROJECT_NAME_UPPER@_INCLUDE_DIR}/../)

@EXTRA_INCLUDE_CMAKE@