Updated CMake files with patches from Michael Surette (STR #2317).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7919 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2010-11-30 10:34:43 +00:00
parent 806542a84f
commit 8c56fc7e22
8 changed files with 83 additions and 70 deletions

View File

@ -7,7 +7,7 @@
set(FLTK_FOUND TRUE)
set(FLTK_VERSION @FLTK_VERSION_FULL@)
set(FLTK_FLUID_EXECUTABLE "@PREFIX_BIN@/fluid")
set(FLTK_FLUID_EXECUTABLE "@FLTK_FLUID_PATH@")
if(NOT "@EXE_LINKER_FLAGS@" STREQUAL "")
set(FLTK_EXE_LINKER_FLAGS "@EXE_LINKER_FLAGS@")
@ -35,4 +35,15 @@ set(FLTK_XINERAMA_FOUND @FLTK_XINERAMA_FOUND@)
set(FLTK_XFT_FOUND @FLTK_XFT_FOUND@)
set(FLTK_XDBE_FOUND @FLTK_XDBE_FOUND@)
set(FLTK_CAIRO_FOUND @FLTK_CAIRO_FOUND@)
set(FLTK_GL_FOUND @FLTK_GL_FOUND@)
set(FLTK_THREADS_FOUND @FLTK_THREADS_FOUND@)
set(FLTK_PTHREADS_FOUND @FLTK_PTHREADS_FOUND@)
set(FLTK_BUILTIN_JPEG_FOUND @FLTK_BUILTIN_JPEG_FOUND@)
set(FLTK_BUILTIN_ZLIB_FOUND @FLTK_BUILTIN_ZLIB_FOUND@)
set(FLTK_BUILTIN_PNG_FOUND @FLTK_BUILTIN_PNG_FOUND@)
set(FLTK_XINERAMA_FOUND @FLTK_XINERAMA_FOUND@)
set(FLTK_XFT_FOUND @FLTK_XFT_FOUND@)
set(FLTK_XDBE_FOUND @FLTK_XDBE_FOUND@)
include("@PREFIX_CONFIG@/FLTKLibraries.cmake")

View File

@ -0,0 +1,17 @@
# On unix create backward compatibility symlinks
if(NOT EXISTS @PREFIX_INCLUDE@/Fl)
EXECUTE_PROCESS(COMMAND ln -s FL Fl
WORKING_DIRECTORY @PREFIX_INCLUDE@
)
endif(NOT EXISTS @PREFIX_INCLUDE@/Fl)
file(GLOB FLTK_HEADER_FILES @PREFIX_INCLUDE@/FL/*.H)
foreach(file ${FLTK_HEADER_FILES})
GET_FILENAME_COMPONENT(nameWE ${file} NAME_WE)
if(NOT EXISTS @PREFIX_INCLUDE@/FL/${nameWE}.h)
EXECUTE_PROCESS(COMMAND ln -s ${nameWE}.H ${nameWE}.h
WORKING_DIRECTORY @PREFIX_INCLUDE@/FL
)
endif()
endforeach(file)

View File

@ -46,38 +46,11 @@ set(ARCHIVE_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
# Search for modules in the FLTK source dir first
set(CMAKE_MODULE_PATH "${FLTK_SOURCE_DIR}/CMake")
include_directories(${FLTK_SOURCE_DIR} ${FLTK_BINARY_DIR})
# If this is out-of-source build, then copy FL directory
if(NOT ${FLTK_SOURCE_DIR} STREQUAL ${FLTK_BINARY_DIR})
file(GLOB FLTK_HEADER_FILES ${FLTK_SOURCE_DIR}/FL/*.[hHr])
foreach(file ${FLTK_HEADER_FILES})
GET_FILENAME_COMPONENT(name ${file} NAME)
CONFIGURE_file(${file} ${FLTK_BINARY_DIR}/FL/${name} COPYONLY)
endforeach(file)
endif(NOT ${FLTK_SOURCE_DIR} STREQUAL ${FLTK_BINARY_DIR})
include_directories(${FLTK_BINARY_DIR} ${FLTK_SOURCE_DIR})
#######################################################################
# platform dependent information
#######################################################################
# On unix create backward compatibility symlinks
if(CMAKE_HOST_UNIX)
if(NOT EXISTS ${FLTK_BINARY_DIR}/Fl)
EXECUTE_PROCESS(COMMAND ln -s FL Fl
WORKING_DIRECTORY ${FLTK_BINARY_DIR}
)
endif(NOT EXISTS ${FLTK_BINARY_DIR}/Fl)
file(GLOB FLTK_HEADER_FILES ${FLTK_BINARY_DIR}/FL/*.H)
foreach(file ${FLTK_HEADER_FILES})
GET_FILENAME_COMPONENT(nameWE ${file} NAME_WE)
if(NOT EXISTS ${FLTK_BINARY_DIR}/FL/${nameWE}.h)
EXECUTE_PROCESS(COMMAND ln -s ${nameWE}.H ${nameWE}.h
WORKING_DIRECTORY ${FLTK_BINARY_DIR}/FL
)
endif()
endforeach(file)
endif(CMAKE_HOST_UNIX)
include(TestBigEndian)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
@ -135,10 +108,6 @@ endif(${SIZEOF_INT} MATCHES "^8$")
#######################################################################
# check for headers, libraries and functions
#######################################################################
# set default search paths
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# headers
find_file(HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h)
find_file(HAVE_DIRENT_H dirent.h)
@ -349,6 +318,7 @@ if(CMAKE_HOST_UNIX)
set(PREFIX_MAN ${CMAKE_INSTALL_PREFIX}/man CACHE INTERNAL "" FORCE)
endif(OPTION_PREFIX_MAN)
option(OPTION_CREATE_LINKS "create backwards compatibility links" OFF)
endif(CMAKE_HOST_UNIX)
#######################################################################
@ -544,7 +514,7 @@ if(X11_Xinerama_FOUND)
endif(X11_Xinerama_FOUND)
if(OPTION_USE_XINERAMA)
set(HAVE_XINERAMA X11_Xinerama_FOUND)
set(HAVE_XINERAMA ${X11_Xinerama_FOUND})
include_directories(${X11_Xinerama_INCLUDE_PATH})
list(APPEND FLTK_LDLIBS -lXinerama)
set(FLTK_XINERAMA_FOUND TRUE)
@ -561,7 +531,7 @@ if(OPTION_USE_XFT)
set(USE_XFT X11_Xft_FOUND)
list(APPEND FLTK_LDLIBS -lXft)
set(FLTK_XFT_FOUND TRUE)
else()
else()
set(FLTK_XFT_FOUND FALSE)
endif(OPTION_USE_XFT)
@ -588,36 +558,40 @@ if(CMAKE_CROSSCOMPILING)
NO_CMAKE_FIND_ROOT_PATH
)
add_executable(fluid IMPORTED)
set(FLTK_FLUID_EXECUTABLE fluid)
set(FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
set(FLTK_FLUID_PATH ${FLUID_PATH})
set_target_properties(fluid
PROPERTIES IMPORTED_LOCATION ${FLUID_PATH}
)
)
else()
add_subdirectory(fluid)
set(FLTK_FLUID_EXECUTABLE fluid)
set(FLTK_FLUID_PATH ${EXECUTABLE_OUTPUT_PATH}/${FLTK_FLUID_EXECUTABLE})
set(FLTK_FLUID_PATH ${PREFIX_BIN}/fluid)
endif(CMAKE_CROSSCOMPILING)
add_subdirectory(src)
# generate FLTKConfig.cmake
string(REPLACE ";" " " EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
configure_file(${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
configure_file(
${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake
@ONLY
)
)
# generate UseFLTK.cmake
configure_file(${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in
configure_file(
${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in
${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake
@ONLY
)
)
# generate config.h
configure_file("${FLTK_SOURCE_DIR}/configh.cmake.in"
"${FLTK_BINARY_DIR}/config.h" @ONLY
)
configure_file(
"${FLTK_SOURCE_DIR}/configh.cmake.in"
"${FLTK_BINARY_DIR}/config.h"
@ONLY
)
# generate fltk-config
get_filename_component(CC ${CMAKE_C_COMPILER} NAME)
@ -630,24 +604,34 @@ if(X11_Xext_FOUND)
endif(X11_Xext_FOUND)
string(REPLACE ";" " " LD_LIBS "${FLTK_LDLIBS}")
configure_file(${FLTK_SOURCE_DIR}/fltk-config.cmake.in
${FLTK_BINARY_DIR}/fltk-config
)
configure_file(
"${FLTK_SOURCE_DIR}/fltk-config.cmake.in"
"${FLTK_BINARY_DIR}/fltk-config"
@ONLY
)
if(UNIX)
execute_process(COMMAND chmod 755 fltk-config
WORKING_DIRECTORY ${FLTK_BINARY_DIR}
WORKING_DIRECTORY "${FLTK_BINARY_DIR}"
)
endif(UNIX)
if(OPTION_CREATE_LINKS)
configure_file(
"${FLTK_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
"${FLTK_BINARY_DIR}/install-symlinks.cmake"
@ONLY
)
endif(OPTION_CREATE_LINKS)
# generate uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY
)
)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
)
)
#######################################################################
# build examples - these have to be after fluid is built/imported
@ -660,31 +644,32 @@ endif(OPTION_BUILD_EXAMPLES)
# installation
#######################################################################
install(DIRECTORY ${FLTK_BINARY_DIR}/FL
install(DIRECTORY ${FLTK_SOURCE_DIR}/FL
DESTINATION ${PREFIX_INCLUDE} USE_SOURCE_PERMISSIONS
)
PATTERN ".svn" EXCLUDE
)
install(DIRECTORY ${FLTK_BINARY_DIR}/Fl
DESTINATION ${PREFIX_INCLUDE} USE_SOURCE_PERMISSIONS
)
if(OPTION_CREATE_LINKS)
install(SCRIPT ${FLTK_BINARY_DIR}/install-symlinks.cmake)
endif(OPTION_CREATE_LINKS)
install(PROGRAMS ${FLTK_BINARY_DIR}/fltk-config
DESTINATION ${PREFIX_BIN}
OPTIONAL
)
)
install(EXPORT fltk-install
DESTINATION ${PREFIX_CONFIG}
FILE FLTKLibraries.cmake
)
)
install(FILES ${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake
DESTINATION ${PREFIX_CONFIG}
)
)
install(FILES ${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake
DESTINATION ${PREFIX_CONFIG}
)
)
if(CMAKE_HOST_UNIX)
macro(INSTALL_MAN FILE LEVEL)
@ -692,7 +677,7 @@ if(CMAKE_HOST_UNIX)
${FLTK_SOURCE_DIR}/documentation/src/${FILE}.man
DESTINATION ${PREFIX_MAN}/man${LEVEL}
RENAME ${FILE}.${LEVEL}
)
)
endmacro(INSTALL_MAN FILE LEVEL)
INSTALL_MAN(fluid 1)

View File

@ -73,7 +73,7 @@
* Do you have the OpenGL glXGetProcAddressARB() function?
*/
#cmakedefine HAVE_GLXGETPROCADDRESSARB
#cmakedefine HAVE_GLXGETPROCADDRESSARB %HAVE_GLXGETPROCADDRESSARB%
/*
* USE_COLORMAP:

View File

@ -59,9 +59,9 @@ OPTIM="@OPTION_OPTIM@"
CAIROFLAGS="@CAIROFLAGS@"
# Check for local invocation, and update paths accordingly...
if test -f "$selfdir/FL/Fl_Window.H"; then
bindir="$selfdir/fluid"
includedir="$selfdir"
if test -f "$selfdir/bin/UseFLTK.cmake"; then
bindir="$selfdir/bin/fluid"
includedir="@FLTK_SOURCE_DIR@"
libdir="$selfdir/lib"
if test -f "$libdir/libfltk_jpeg.a"; then

View File

@ -29,12 +29,12 @@
#include <FL/Fl_Printer.H>
#ifdef __APPLE__
#include <src/Fl_Quartz_Printer.mm>
#include "Fl_Quartz_Printer.mm"
#elif defined(WIN32)
#include <src/Fl_GDI_Printer.cxx>
#include "Fl_GDI_Printer.cxx"
#endif
#include <src/Fl_PostScript.cxx>
#include "Fl_PostScript.cxx"
// print dialog customization strings
/** [this text may be customized at run-time] */

View File

@ -3,7 +3,7 @@ set(EXECUTABLE_OUTPUT_PATH ${FLTK_BINARY_DIR}/bin/examples)
#######################################################################
# audio libs for test apps
if(WIN32)
set(AUDIOLIBS -lwinmm)
set(AUDIOLIBS winmm)
elseif(APPLE)
set(AUDIOLIBS "-framework CoreAudio")
elseif(HAVE_ALSA_ASOUNDLIB_H)

View File

@ -23,7 +23,7 @@
#include <FL/Fl_Light_Button.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Clock.H>
#include <test/pixmaps/porsche.xpm>
#include "pixmaps/porsche.xpm"
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Bitmap.H>
#include <FL/Fl_Round_Button.H>