[Cmake] How can I contribute CMake "FindFoo.cmake" files that I might write?
Suzanne Vogel
vogel at cs.unc.edu
Fri Jun 21 11:11:11 EDT 2002
** How can I contribute CMake "FindFoo.cmake" files that I might write?
I've written one to find FL-Inventor (below), a version of Open Inventor
that uses FLTK. UNC's contributors to ITK (Insight Toolkit) are
considering incorporating FL-Inventor into ITK.
Thanks,
Suzanne
---------------------------------------------------------------------------
# File: FindFLIV.cmake
#
# This module looks for FLIV (FL-Inventor).
#
# It requires the following values from the user:
#
# FLIV_SOURCE_DIR = the root of the FL-Inventor source files.
# FLIV_BINARY_DIR = the root of the FL-Inventor binary files.
#
# -> WARNING: This file was tested only with FLIV_SOURCE_DIR =
FLIV_BINARY_DIR. The reason was that
# if FLIV_SOURCE_DIR != FLIV_BINARY_DIR, then FL-Inventor would not
compile, probably due to the
# way that FL-Inventor's CMakeLists.txt files are written.
#
# It uses the following options:
#
# FLIV_INCLUDE_ALL = defined if the user wants to include all FLIV
header-file directories.
#
# It will define the following values. The format is
(generally)FLIV_foo_INCLUDE_PATH,
# where foo/include is the name of the header-file (*.h) subdirectory.
#
# FLIV_inventor_INCLUDE_PATH (does not follow format) = path to
directory containing header files.
# FLIV_database_INCLUDE_PATH = ""
# FLIV_interaction_INCLUDE_PATH = ""
# FLIV_nodekits_INCLUDE_PATH = ""
# FLIV_lib_INCLUDE_PATH = ""
# FLIV_SoFl_INCLUDE_PATH (does not follow format) = ""
#
# FLIV_inventor_LIB = path to inventor.lib.
# FLIV_SoFl_LIB = path to SoFl.lib.
# FLIV_FL_LIB = path to FL.lib (part of FLTK package).
#
# It will also define the following values. These values probably are
not necessary for the programmer to use directly.
#
# INTTYPES_INCLUDE_PATH
# FREETYPE_INCLUDE_PATH
# FL_INCLUDE_PATH (already included in FLTK -- See FindFLTK.cmake)
#
# FLIV_FreeType2_LIB
# FLIV_Jpeg_LIB
# Find the FLIV source and binary directories.
# Note: Looking in directory usr/ is a hack to satisfy CMake. Really, we
have no idea where to look!
# Since FLIV will not be found, the user will be prompted to navigate to
its location, which is okay.
FIND_PATH(FLIV_SOURCE_DIR build/inventor/inventor.h usr)
FIND_PATH(FLIV_BINARY_DIR install/bin/Release/inventor.dll usr)
# First find the necessary directories.
SET(FLIV_inventor_INCLUDE_PATH ${FLIV_SOURCE_DIR}/build/inventor)
SET(FLIV_database_INCLUDE_PATH
${FLIV_SOURCE_DIR}/build/inventor/lib/database/include)
SET(FLIV_interaction_INCLUDE_PATH
${FLIV_SOURCE_DIR}/build/inventor/lib/interaction/include)
SET(FLIV_nodekits_INCLUDE_PATH
${FLIV_SOURCE_DIR}/build/inventor/lib/nodekits/include)
SET(FLIV_lib_INCLUDE_PATH
${FLIV_SOURCE_DIR}/build/inventor/libSoXt/lib/include)
SET(FLIV_SoFl_INCLUDE_PATH ${FLIV_SOURCE_DIR}/build/SoFl/lib/include)
SET(INTTYPES_INCLUDE_PATH
${FLIV_SOURCE_DIR}/build/inventor/lib/visualc/include)
# First find the necessary libraries. In advanced mode, display their
names in the CMake interface.
SET(FLIV_inventor_LIB inventor CACHE STRING "FL-Inventor library")
SET(FLIV_inventor_LIB
${FLIV_BINARY_DIR}/install/bin/Release/${FLIV_inventor_LIB}.lib)
MARK_AS_ADVANCED(FLIV_inventor_LIB)
SET(FLIV_SoFl_LIB SoFl CACHE STRING "FL-Inventor's SoFl library")
SET(FLIV_SoFl_LIB
${FLIV_BINARY_DIR}/install/lib/Release/${FLIV_SoFl_LIB}.lib)
MARK_AS_ADVANCED(FLIV_SoFl_LIB)
SET(FLIV_FL_LIB FL CACHE STRING "FL-Inventor's FL library")
SET(FLIV_FL_LIB
${FLIV_BINARY_DIR}/install/lib/Release/${FLIV_FL_LIB}.lib)
MARK_AS_ADVANCED(FLIV_FL_LIB)
# Then find the unnecessary directories.
SET(FREETYPE_INCLUDE_PATH
${FLIV_SOURCE_DIR}/build/inventor/misc/freetype2/include)
SET(FL_INCLUDE_PATH ${FLIV_SOURCE_DIR}/build/inventor/misc)
# Then find the unnecessary libraries.
SET(FLIV_FreeType2_LIB ${FLIV_BINARY_DIR}/install/lib/Release/FreeType2.lib)
SET(FLIV_Jpeg_LIB ${FLIV_BINARY_DIR}/install/lib/Release/Jpeg.lib)
# If the user desires, include all necessary FLIV header-file directories.
IF(FLIV_INCLUDE_ALL)
INCLUDE_DIRECTORIES(
${FLIV_inventor_INCLUDE_PATH}
${FLIV_database_INCLUDE_PATH}
${FLIV_interaction_INCLUDE_PATH}
${FLIV_nodekits_INCLUDE_PATH}
${FLIV_lib_INCLUDE_PATH}
${FLIV_SoFl_INCLUDE_PATH}
${INTTYPES_INCLUDE_PATH}
)
ENDIF(FLIV_INCLUDE_ALL)
# If the user desires, link to all necessary FLIV libraries.
IF(FLIV_LINK_ALL)
LINK_LIBRARIES (
${FLIV_inventor_LIB}
${FLIV_SoFl_LIB}
${FLIV_FL_LIB}
)
ENDIF(FLIV_LINK_ALL)
More information about the CMake
mailing list