template_find_project.cmake 2.91 KB
Newer Older
Pierre Aubert's avatar
Pierre Aubert committed
1 2 3 4 5 6 7 8 9

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

@PHOENIX_PACKAGE_PEDENDENCIES@

10 11 12 13 14 15 16 17
if(@PROJECT_NAME_UPPER@_FOUND)
	link_directories(${@PROJECT_NAME_UPPER@_LIBRARY_DIR})
	include_directories(${@PROJECT_NAME_UPPER@_INCLUDE_DIR} ${@PROJECT_NAME_UPPER@_INCLUDE_DIR}/../)

	@EXTRA_INCLUDE_CMAKE@
	return()
endif()

Pierre Aubert's avatar
Pierre Aubert committed
18 19 20 21 22 23 24 25
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}")
26
	set(@PROJECT_NAME_UPPER@_INCLUDE_DIR "${@PROJECT_NAME_UPPER@_INCLUDE_DIR}" CACHE STRING "@PROJECT_NAME_UPPER@ include directory")
Pierre Aubert's avatar
Pierre Aubert committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
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}")
51
	set(@PROJECT_NAME_UPPER@_LIBRARY_DIR "${@PROJECT_NAME_UPPER@_LIBRARY_DIR}" CACHE STRING "@PROJECT_NAME_UPPER@ library directory")
Pierre Aubert's avatar
Pierre Aubert committed
52 53 54 55 56 57
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
58
set(@PROJECT_NAME_UPPER@ @libraryTargetName@ @EXTRA_DEPENDENCIES_LIB@ CACHE BOOL "@PROJECT_NAME_UPPER@ library and dependencies")
Pierre Aubert's avatar
Pierre Aubert committed
59

Pierre Aubert's avatar
Pierre Aubert committed
60
set(@PROJECT_NAME_UPPER@_FOUND "YES" CACHE BOOL "@PROJECT_NAME_UPPER@ progect found")
Pierre Aubert's avatar
Pierre Aubert committed
61 62 63 64 65 66

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

@EXTRA_INCLUDE_CMAKE@