CMake: enable building FLTK in a subdirectory of another project.
Basically replace CMAKE_XXX_DIR with CMAKE_CURRENT_XXX_DIR where XXX = SOURCE or BINARY. Patch proposal by cleanrock, FLTK PR #4: https://github.com/fltk/test-only/pull/4 Patch modified to fix target dirs for test programs and doxygen docs. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12630 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
b47dc05909
commit
7aef0cad39
@ -4,7 +4,7 @@
|
||||
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
||||
# Written by Michael Surette
|
||||
#
|
||||
# Copyright 1998-2017 by Bill Spitzak and others.
|
||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
||||
#
|
||||
# This library is free software. Distribution and use rights are outlined in
|
||||
# the file "COPYING" which should have been included with this file. If this
|
||||
@ -42,43 +42,43 @@ endif(CMAKE_CROSSCOMPILING)
|
||||
add_subdirectory(src)
|
||||
|
||||
# generate FLTK-Targets.cmake for build directory use
|
||||
export(TARGETS ${FLUID} ${FLTK_LIBRARIES} FILE ${CMAKE_BINARY_DIR}/FLTK-Targets.cmake)
|
||||
export(TARGETS ${FLUID} ${FLTK_LIBRARIES} FILE ${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake)
|
||||
|
||||
# generate FLTKConfig.cmake for build directory use
|
||||
set(INCLUDE_DIRS "${FLTK_INCLUDE_DIRS}")
|
||||
set(CONFIG_PATH ${CMAKE_BINARY_DIR})
|
||||
set(CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
|
||||
${CMAKE_BINARY_DIR}/FLTKConfig.cmake
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/FLTKConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# generate UseFLTK.cmake for build directory use
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/CMake/UseFLTK.cmake.in
|
||||
${CMAKE_BINARY_DIR}/UseFLTK.cmake
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake/UseFLTK.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/UseFLTK.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# generate fltk-config for build directory use
|
||||
set(prefix ${CMAKE_BINARY_DIR})
|
||||
set(prefix ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(includedir "${CMAKE_SOURCE_DIR}")
|
||||
set(BINARY_DIR "${CMAKE_BINARY_DIR}")
|
||||
set(includedir "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(libdir "\${exec_prefix}/lib")
|
||||
set(srcdir ".")
|
||||
|
||||
set(LIBNAME "${libdir}/libfltk.a")
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/fltk-config.in"
|
||||
"${CMAKE_BINARY_DIR}/fltk-config"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/fltk-config.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/fltk-config"
|
||||
@ONLY
|
||||
)
|
||||
if(UNIX)
|
||||
execute_process(COMMAND chmod 755 fltk-config
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
)
|
||||
endif(UNIX)
|
||||
|
||||
@ -102,8 +102,8 @@ set(CONFIG_H config.h)
|
||||
# generate config.h
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/${CONFIG_H_IN}"
|
||||
"${CMAKE_BINARY_DIR}/${CONFIG_H}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${CONFIG_H_IN}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_H}"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
@ -115,8 +115,8 @@ if(OPTION_CREATE_LINKS)
|
||||
set(PREFIX_INCLUDE "${CMAKE_INSTALL_PREFIX}/${FLTK_INCLUDEDIR}")
|
||||
endif(IS_ABSOLUTE ${FLTK_INCLUDEDIR})
|
||||
configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/install-symlinks.cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/install-symlinks.cmake"
|
||||
@ONLY
|
||||
)
|
||||
endif(OPTION_CREATE_LINKS)
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
||||
# Written by Michael Surette
|
||||
#
|
||||
# Copyright 1998-2017 by Bill Spitzak and others.
|
||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
||||
#
|
||||
# This library is free software. Distribution and use rights are outlined in
|
||||
# the file "COPYING" which should have been included with this file. If this
|
||||
@ -31,17 +31,17 @@ add_custom_target(uninstall
|
||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
)
|
||||
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/FL
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/FL
|
||||
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/FL
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/FL
|
||||
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
|
||||
)
|
||||
|
||||
if(OPTION_CREATE_LINKS)
|
||||
install(SCRIPT ${CMAKE_BINARY_DIR}/install-symlinks.cmake)
|
||||
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install-symlinks.cmake)
|
||||
endif(OPTION_CREATE_LINKS)
|
||||
|
||||
# generate FLTKConfig.cmake for installed directory use
|
||||
@ -55,22 +55,22 @@ install(EXPORT FLTK-Targets
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
|
||||
${CMAKE_BINARY_DIR}/etc/FLTKConfig.cmake
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/etc/FLTKConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
install(FILES ${CMAKE_BINARY_DIR}/etc/FLTKConfig.cmake
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/FLTKConfig.cmake
|
||||
DESTINATION ${FLTK_CONFIG_PATH}
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/CMake/UseFLTK.cmake.in
|
||||
${CMAKE_BINARY_DIR}/etc/UseFLTK.cmake
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake/UseFLTK.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/etc/UseFLTK.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
install(FILES ${CMAKE_BINARY_DIR}/etc/UseFLTK.cmake
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/UseFLTK.cmake
|
||||
DESTINATION ${FLTK_CONFIG_PATH}
|
||||
)
|
||||
|
||||
@ -85,24 +85,24 @@ set(srcdir ".")
|
||||
set(LIBNAME "${libdir}/libfltk.a")
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/fltk-config.in"
|
||||
"${CMAKE_BINARY_DIR}/bin/fltk-config"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/fltk-config.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-config"
|
||||
@ONLY
|
||||
)
|
||||
if(UNIX)
|
||||
execute_process(COMMAND chmod 755 fltk-config
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
|
||||
)
|
||||
endif(UNIX)
|
||||
|
||||
install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/fltk-config
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-config
|
||||
DESTINATION ${FLTK_BINDIR}
|
||||
)
|
||||
|
||||
if(UNIX OR MSYS OR (MINGW AND CMAKE_CROSSCOMPILING))
|
||||
macro(INSTALL_MAN FILE LEVEL)
|
||||
install(FILES
|
||||
${CMAKE_SOURCE_DIR}/documentation/src/${FILE}.man
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/documentation/src/${FILE}.man
|
||||
DESTINATION ${FLTK_MANDIR}/man${LEVEL}
|
||||
RENAME ${FILE}.${LEVEL}
|
||||
)
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
||||
# Written by Michael Surette
|
||||
#
|
||||
# Copyright 1998-2017 by Bill Spitzak and others.
|
||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
||||
#
|
||||
# This library is free software. Distribution and use rights are outlined in
|
||||
# the file "COPYING" which should have been included with this file. If this
|
||||
@ -282,8 +282,8 @@ if(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND)
|
||||
else()
|
||||
add_subdirectory(zlib)
|
||||
set(FLTK_ZLIB_LIBRARIES fltk_z)
|
||||
set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/zlib)
|
||||
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zlib)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/zlib)
|
||||
set(FLTK_BUILTIN_ZLIB_FOUND TRUE)
|
||||
endif(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND)
|
||||
|
||||
@ -307,7 +307,7 @@ if(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
|
||||
else()
|
||||
add_subdirectory(jpeg)
|
||||
set(FLTK_JPEG_LIBRARIES fltk_jpeg)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/jpeg)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/jpeg)
|
||||
set(FLTK_BUILTIN_JPEG_FOUND TRUE)
|
||||
endif(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
|
||||
|
||||
@ -335,7 +335,7 @@ else()
|
||||
set(HAVE_PNG_H 1)
|
||||
set(HAVE_PNG_GET_VALID 1)
|
||||
set(HAVE_PNG_SET_TRNS_TO_ALPHA 1)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/png)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/png)
|
||||
set(FLTK_BUILTIN_PNG_FOUND TRUE)
|
||||
endif(OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND)
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
||||
# Written by Michael Surette
|
||||
#
|
||||
# Copyright 1998-2017 by Bill Spitzak and others.
|
||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
||||
#
|
||||
# This library is free software. Distribution and use rights are outlined in
|
||||
# the file "COPYING" which should have been included with this file. If this
|
||||
@ -187,8 +187,8 @@ if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
|
||||
set(MSG "POSIX compatible scandir")
|
||||
message(STATUS "Looking for ${MSG}")
|
||||
try_compile(V
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/CMake/posixScandir.cxx
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake/posixScandir.cxx
|
||||
)
|
||||
if(V)
|
||||
message(STATUS "${MSG} - found")
|
||||
|
@ -4,7 +4,7 @@
|
||||
# CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
||||
# Written by Michael Surette
|
||||
#
|
||||
# Copyright 1998-2017 by Bill Spitzak and others.
|
||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
||||
#
|
||||
# This library is free software. Distribution and use rights are outlined in
|
||||
# the file "COPYING" which should have been included with this file. If this
|
||||
@ -28,16 +28,20 @@ set(FLTK_VERSION_PATCH "0")
|
||||
set(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
|
||||
set(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
|
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
||||
set(ARCHIVE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||||
set(ARCHIVE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||||
|
||||
# Search for modules in the FLTK source dir first
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
|
||||
|
||||
set(FLTK_INCLUDE_DIRS ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
||||
set(FLTK_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
include_directories(${FLTK_INCLUDE_DIRS})
|
||||
|
||||
# Remember root of FLTK source directory in case we're in a subdirectory.
|
||||
# Used for instance to find the source directory for doxygen docs
|
||||
set(FLTK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Setup install locations
|
||||
if(CMAKE_VERSION VERSION_GREATER 2.8.4)
|
||||
# Use GNUInstallDirs if available.
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
||||
# Written by Michael Surette
|
||||
#
|
||||
# Copyright 1998-2014 by Bill Spitzak and others.
|
||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
||||
#
|
||||
# This library is free software. Distribution and use rights are outlined in
|
||||
# the file "COPYING" which should have been included with this file. If this
|
||||
@ -58,8 +58,8 @@ include(CMake/variables.cmake)
|
||||
include(CMake/export.cmake)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/abi-version.cmake.in
|
||||
${CMAKE_BINARY_DIR}/FL/abi-version.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abi-version.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/FL/abi-version.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# CMakeLists.txt to build docs for the FLTK project using CMake (www.cmake.org)
|
||||
#
|
||||
# Copyright 1998-2015 by Bill Spitzak and others.
|
||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
||||
#
|
||||
# This library is free software. Distribution and use rights are outlined in
|
||||
# the file "COPYING" which should have been included with this file. If this
|
||||
@ -123,7 +123,7 @@ endif (DOCS)
|
||||
|
||||
if(OPTION_INSTALL_HTML_DOCUMENTATION AND OPTION_BUILD_HTML_DOCUMENTATION)
|
||||
|
||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/documentation/html
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
|
||||
DESTINATION ${FLTK_DATADIR}/doc/fltk
|
||||
)
|
||||
|
||||
@ -131,7 +131,7 @@ endif(OPTION_INSTALL_HTML_DOCUMENTATION AND OPTION_BUILD_HTML_DOCUMENTATION)
|
||||
|
||||
if(OPTION_INSTALL_PDF_DOCUMENTATION AND OPTION_BUILD_PDF_DOCUMENTATION)
|
||||
|
||||
install(FILES ${CMAKE_BINARY_DIR}/documentation/fltk.pdf
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fltk.pdf
|
||||
DESTINATION ${FLTK_DATADIR}/doc/fltk/
|
||||
)
|
||||
|
||||
|
@ -565,9 +565,9 @@ INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/opengl.dox
|
||||
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/fluid.dox
|
||||
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/advanced.dox
|
||||
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/unicode.dox
|
||||
INPUT += @CMAKE_SOURCE_DIR@/FL
|
||||
INPUT += @CMAKE_SOURCE_DIR@/src
|
||||
INPUT += @CMAKE_SOURCE_DIR@/cairo
|
||||
INPUT += @FLTK_SOURCE_DIR@/FL
|
||||
INPUT += @FLTK_SOURCE_DIR@/src
|
||||
INPUT += @FLTK_SOURCE_DIR@/cairo
|
||||
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/enumerations.dox
|
||||
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/glut.dox
|
||||
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/forms.dox
|
||||
@ -610,13 +610,13 @@ RECURSIVE = YES
|
||||
# excluded from the INPUT source files. This way you can easily exclude a
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
|
||||
EXCLUDE = @CMAKE_SOURCE_DIR@/src/drivers/
|
||||
EXCLUDE += @CMAKE_SOURCE_DIR@/src/fl_dnd_win32.cxx
|
||||
EXCLUDE += @CMAKE_SOURCE_DIR@/src/fl_dnd_x.cxx
|
||||
EXCLUDE += @CMAKE_SOURCE_DIR@/src/fl_font_mac.cxx
|
||||
EXCLUDE += @CMAKE_SOURCE_DIR@/src/fl_font_win32.cxx
|
||||
EXCLUDE += @CMAKE_SOURCE_DIR@/src/Fl_get_key_mac.cxx
|
||||
EXCLUDE += @CMAKE_SOURCE_DIR@/src/Fl_get_key_win32.cxx
|
||||
EXCLUDE = @FLTK_SOURCE_DIR@/src/drivers/
|
||||
EXCLUDE += @FLTK_SOURCE_DIR@/src/fl_dnd_win32.cxx
|
||||
EXCLUDE += @FLTK_SOURCE_DIR@/src/fl_dnd_x.cxx
|
||||
EXCLUDE += @FLTK_SOURCE_DIR@/src/fl_font_mac.cxx
|
||||
EXCLUDE += @FLTK_SOURCE_DIR@/src/fl_font_win32.cxx
|
||||
EXCLUDE += @FLTK_SOURCE_DIR@/src/Fl_get_key_mac.cxx
|
||||
EXCLUDE += @FLTK_SOURCE_DIR@/src/Fl_get_key_win32.cxx
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
|
||||
# directories that are symbolic links (a Unix filesystem feature) are excluded
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# CMakeLists.txt used to build test and demo apps by the CMake build system
|
||||
#
|
||||
# Copyright 2004-2017 by Bill Spitzak and others.
|
||||
# Copyright 2004-2018 by Bill Spitzak and others.
|
||||
#
|
||||
# This library is free software. Distribution and use rights are outlined in
|
||||
# the file "COPYING" which should have been included with this file. If this
|
||||
@ -17,7 +17,7 @@
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/examples)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../bin/examples)
|
||||
|
||||
#######################################################################
|
||||
# audio libs for test apps
|
||||
|
Loading…
x
Reference in New Issue
Block a user