diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-04-05 22:33:58 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-04-05 22:33:58 +0000 |
| commit | a0d26b634afd9234234f3343c25961b7ffdb7be0 (patch) | |
| tree | dc8fb2ee36d894ae5377a94baaf0809143aa2ec2 /CMake | |
| parent | 2bf6fa6074303c8c7bcd16736be6e244dcaf3c39 (diff) | |
Mostly rewritten CMake files by Michael Surette. They are more complete
than what we had previously, but may need some more testing. The latest
changes (removing old APPLE_QD definitions and code) might need another
update.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7451 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'CMake')
| -rw-r--r-- | CMake/CheckFunctionWithHeaderExists.cmake | 54 | ||||
| -rw-r--r-- | CMake/FLTKConfig.cmake.in | 51 | ||||
| -rw-r--r-- | CMake/FLTKUse.cmake | 98 | ||||
| -rw-r--r-- | CMake/PlatformTests.cxx | 140 | ||||
| -rw-r--r-- | CMake/UseFLTK.cmake.in | 8 | ||||
| -rw-r--r-- | CMake/cmake_uninstall.cmake.in | 19 | ||||
| -rw-r--r-- | CMake/posixScandir.cxx | 10 |
7 files changed, 63 insertions, 317 deletions
diff --git a/CMake/CheckFunctionWithHeaderExists.cmake b/CMake/CheckFunctionWithHeaderExists.cmake deleted file mode 100644 index 46694e82a..000000000 --- a/CMake/CheckFunctionWithHeaderExists.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# -# Check if the symbol exists in include files -# -# CHECK_FUNCTIONWITHHEADER_EXISTS - macro which checks the symbol exists in include files. -# SYMBOL - symbol -# FILES - include files to check -# VARIABLE - variable to return result -# - -MACRO(CHECK_FUNCTIONWITHHEADER_EXISTS SYMBOL FILES VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(CHECK_SYMBOL_EXISTS_CONTENT "/* */\n") - SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) - IF(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_SYMBOL_EXISTS_LIBS - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - ENDIF(CMAKE_REQUIRED_LIBRARIES) - FOREACH(FILE ${FILES}) - SET(CHECK_SYMBOL_EXISTS_CONTENT - "${CHECK_SYMBOL_EXISTS_CONTENT}#include <${FILE}>\n") - ENDFOREACH(FILE) - SET(CHECK_SYMBOL_EXISTS_CONTENT - "${CHECK_SYMBOL_EXISTS_CONTENT}\nint main()\n{\n${SYMBOL};return 0;\n}\n") - - FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.c - "${CHECK_SYMBOL_EXISTS_CONTENT}") - - MESSAGE(STATUS "Looking for ${SYMBOL}") - TRY_COMPILE(${VARIABLE} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.c - CMAKE_FLAGS - -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS} - "${CHECK_SYMBOL_EXISTS_LIBS}" - OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - MESSAGE(STATUS "Looking for ${SYMBOL} - found") - SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") - FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log - "Determining if the ${SYMBOL} " - "exist passed with the following output:\n" - "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.c:\n" - "${CHECK_SYMBOL_EXISTS_CONTENT}\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for ${SYMBOL} - not found.") - SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") - FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log - "Determining if the ${SYMBOL} " - "exist failed with the following output:\n" - "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.c:\n" - "${CHECK_SYMBOL_EXISTS_CONTENT}\n") - ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(CHECK_FUNCTIONWITHHEADER_EXISTS) diff --git a/CMake/FLTKConfig.cmake.in b/CMake/FLTKConfig.cmake.in index 3ed435b11..0501c6674 100644 --- a/CMake/FLTKConfig.cmake.in +++ b/CMake/FLTKConfig.cmake.in @@ -1,37 +1,38 @@ -#----------------------------------------------------------------------------- # # FLTKConfig.cmake - FLTK CMake configuration file for external projects. # # This file is configured by FLTK and used by the UseFLTK.cmake module # to load FLTK's settings for an external project. -# The FLTK source tree. -SET(FLTK_SOURCE_DIR "@FLTK_SOURCE_DIR@") +set(FLTK_FOUND TRUE) +set(FLTK_VERSION @FLTK_VERSION_FULL@) -# The FLTK include file directories. -SET(FLUID_COMMAND "@FLTK_FLUID_COMMAND@") -SET(FLTK_EXECUTABLE_DIRS "@FLTK_EXECUTABLE_DIRS@") -SET(FLTK_LIBRARY_DIRS "@FLTK_LIBRARY_DIRS@") -SET(FLTK_LIBRARIES "@FLTK_LIBRARIES@") -SET(FLTK_INCLUDE_DIRS "@FLTK_INCLUDE_DIRS@") +set(FLTK_FLUID_EXECUTABLE "@PREFIX_BIN@/fluid") -# The C and C++ flags added by FLTK to the cmake-configured flags. -SET(FLTK_REQUIRED_C_FLAGS "@FLTK_REQUIRED_C_FLAGS@") -SET(FLTK_REQUIRED_CXX_FLAGS "@FLTK_REQUIRED_CXX_FLAGS@") +if(NOT "@EXE_LINKER_FLAGS@" STREQUAL "") + set(FLTK_EXE_LINKER_FLAGS "@EXE_LINKER_FLAGS@") +endif(NOT "@EXE_LINKER_FLAGS@" STREQUAL "") -# The FLTK version number -SET(FLTK_VERSION_MAJOR "@FLTK_VERSION_MAJOR@") -SET(FLTK_VERSION_MINOR "@FLTK_VERSION_MINOR@") -SET(FLTK_VERSION_PATCH "@FLTK_VERSION_PATCH@") +set(FLTK_USE_FILE "@PREFIX_CONFIG@/UseFLTK.cmake") -# Is FLTK using shared libraries? -SET(FLTK_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@") -SET(FLTK_BUILD_SETTINGS_FILE "@FLTK_BUILD_SETTINGS_FILE@") +set(FLTK_DIR "@PREFIX_CONFIG@") -# The location of the UseFLTK.cmake file. -SET(FLTK11_USE_FILE "@FLTK_USE_FILE@") +set(FLTK_BIN_DIR "@PREFIX_BIN@") +set(FLTK_LIB_DIR "@PREFIX_LIB@") +set(FLTK_INCLUDE_DIR "@PREFIX_INCLUDE@") +set(FLTK_DATA_DIR "@PREFIX_DATA@") +set(FLTK_DOC_DIR "@PREFIX_DOC@") -# The ExodusII library dependencies. -IF(NOT FLTK_NO_LIBRARY_DEPENDS) - INCLUDE("@FLTK_LIBRARY_DEPENDS_FILE@") -ENDIF(NOT FLTK_NO_LIBRARY_DEPENDS) +set(FLTK_SHARED_LIBS_FOUND @OPTION_BUILD_SHARED_LIBS@) +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") diff --git a/CMake/FLTKUse.cmake b/CMake/FLTKUse.cmake deleted file mode 100644 index 938366308..000000000 --- a/CMake/FLTKUse.cmake +++ /dev/null @@ -1,98 +0,0 @@ -# -# "$Id$" -# -# CMake support file to build the FLTK project using CMake (www.cmake.org) -# -# Copyright 1998-2010 by Bill Spitzak and others. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# Please report all bugs and problems on the following page: -# -# http:#www.fltk.org/str.php -# - -IF(NOT FLTK11_FOUND) - MESSAGE(FATAL_ERROR "Something went wrong. You are including FLTKUse.cmake but FLTK was not found") -ENDIF(NOT FLTK11_FOUND) - -# ------------------------------------------------------------- -# This macro automates wrapping of Fluid files -# Specify the output variable name and the list of sources -# The output variable can be directly added to the target. -# -# For example: -# FLTK_WRAP_FLUID(CubeView_SRCS CubeViewUI.fl) -# ADD_EXECUTABLE(CubeView CubeMain.cxx CubeView.cxx CubeView.h ${CubeView_SRCS}) -# ------------------------------------------------------------- -MACRO(FLTK_WRAP_FLUID VARIABLE) - FOREACH(src ${ARGN}) - IF("${src}" MATCHES ".fl$") - GET_FILENAME_COMPONENT(fname ${src} NAME_WE) - GET_FILENAME_COMPONENT(fpath ${src} PATH) - GET_SOURCE_FILE_PROPERTY(gen ${src} GENERATED) - IF(gen) - SET(fluid_name "${src}") - ELSE(gen) - SET(fluid_name "${CMAKE_CURRENT_SOURCE_DIR}/${fpath}/${fname}.fl") - IF(NOT EXISTS "${fluid_name}") - SET(fluid_name "${CMAKE_CURRENT_BINARY_DIR}/${fpath}/${fname}.fl") - IF(NOT EXISTS "${fluid_name}") - SET(fluid_name "${fpath}/${fname}.fl") - IF(NOT EXISTS "${fluid_name}") - MESSAGE(SEND_ERROR "Cannot find Fluid source file: ${fpath}/${fname}.fl") - ENDIF(NOT EXISTS "${fluid_name}") - ENDIF(NOT EXISTS "${fluid_name}") - ENDIF(NOT EXISTS "${fluid_name}") - ENDIF(gen) - SET(cxx_name "${CMAKE_CURRENT_BINARY_DIR}/${fname}.cxx") - SET(h_name "${CMAKE_CURRENT_BINARY_DIR}/${fname}.h") - SET(${VARIABLE} "${${VARIABLE}};${cxx_name}") - ADD_CUSTOM_COMMAND( - OUTPUT ${cxx_name} - DEPENDS "${fluid_name}" "${FLUID_COMMAND}" - COMMAND ${FLUID_COMMAND} - ARGS -c ${fluid_name}) - ADD_CUSTOM_COMMAND( - OUTPUT ${h_name} - DEPENDS "${fluid_name}" "${FLUID_COMMAND}" - COMMAND ${FLUID_COMMAND} - ARGS -c ${fluid_name}) - ENDIF("${src}" MATCHES ".fl$") - ENDFOREACH(src) -ENDMACRO(FLTK_WRAP_FLUID VARIABLE) - - -# Make FLTK easier to use -INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIRS}) -LINK_DIRECTORIES(${FLTK_LIBRARY_DIRS}) - -# Load the compiler settings used for FLTK. -IF(FLTK_BUILD_SETTINGS_FILE) - INCLUDE(CMakeImportBuildSettings) - CMAKE_IMPORT_BUILD_SETTINGS(${FLTK_BUILD_SETTINGS_FILE}) -ENDIF(FLTK_BUILD_SETTINGS_FILE) - -# Add compiler flags needed to use FLTK. -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLTK_REQUIRED_C_FLAGS}") -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLTK_REQUIRED_CXX_FLAGS}") -SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLTK_REQUIRED_EXE_LINKER_FLAGS}") -SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FLTK_REQUIRED_SHARED_LINKER_FLAGS}") -SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FLTK_REQUIRED_MODULE_LINKER_FLAGS}") - -# -# End of "$Id$". -# diff --git a/CMake/PlatformTests.cxx b/CMake/PlatformTests.cxx deleted file mode 100644 index a4e9c73b3..000000000 --- a/CMake/PlatformTests.cxx +++ /dev/null @@ -1,140 +0,0 @@ -// -// "$Id$" -// -// CMake platform tests for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2010 by Bill Spitzak and others. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Library General Public -// License as published by the Free Software Foundation; either -// version 2 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Library General Public License for more details. -// -// You should have received a copy of the GNU Library General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA. -// -// Please report all bugs and problems on the following page: -// -// http://www.fltk.org/str.php -// - -// -// The platform tests in this file are invoked by the CMake macro -// PERFORM_CMAKE_TEST in CMakeLists.txt (or maybe other files). -// -// Each platform test in this file must begin and end with -// #ifdef FOO -// ... -// #endif -// where FOO is the compiler macro to be tested/defined in config.h. -// -// It must contain a main() function and return 0 if the test succeeded. -// - -#ifdef HAVE_LIBZ - -#include <zlib.h> - -int main() { - unsigned long compressedSize = 0; - unsigned char cd[100]; - const unsigned char ud[100] = ""; - unsigned long uncompressedSize = 0; - - // Call zlib's compress function. - if (compress(cd, &compressedSize, ud, uncompressedSize) != Z_OK) { - return 0; - } - return 1; -} - -#endif - - -#ifdef HAVE_LIBJPEG - -#include <stdio.h> -#include <jpeglib.h> - -int main() { - struct jpeg_decompress_struct cinfo; - jpeg_create_decompress(&cinfo); - jpeg_read_header(&cinfo, TRUE); - return 1; -} - -#endif - - -#ifdef HAVE_LIBPNG -#include <png.h> -int main() -{ - png_structp png_ptr = png_create_read_struct - (PNG_LIBPNG_VER_STRING, (png_voidp)NULL, - NULL, NULL); - png_infop info_ptr = png_create_info_struct(png_ptr); - png_set_sig_bytes(png_ptr, 8); - png_read_info(png_ptr, info_ptr); - - return 0; -} -#endif - - -// This one is probably not used: -#ifdef HAVE_PNG_H -#include <png.h> -int main() { return 0;} -#endif - - -#ifdef HAVE_PNG_GET_VALID -#include <png.h> - -int main() { - png_structp png_ptr = png_create_read_struct - (PNG_LIBPNG_VER_STRING, (png_voidp)NULL, - NULL, NULL); - png_infop info_ptr = png_create_info_struct(png_ptr); - png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS); - return 0; -} -#endif - - -#ifdef HAVE_PNG_SET_TRNS_TO_ALPHA -#include <png.h> - -int main() { - png_structp png_ptr = png_create_read_struct - (PNG_LIBPNG_VER_STRING, (png_voidp)NULL, - NULL, NULL); - png_set_tRNS_to_alpha(png_ptr); - return 0; -} -#endif - - -#ifdef HAVE_SCANDIR_POSIX -#include <dirent.h> - -int func (const char *d, dirent ***list, void *sort) { - int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort); -} - -int main() { - return 0; -} -#endif - -// -// End of "$Id$". -// diff --git a/CMake/UseFLTK.cmake.in b/CMake/UseFLTK.cmake.in new file mode 100644 index 000000000..9518d26ba --- /dev/null +++ b/CMake/UseFLTK.cmake.in @@ -0,0 +1,8 @@ +# +# automatically generated - do not edit + +include_directories("@PREFIX_INCLUDE@") + +if(FLTK_EXE_LINKER_FLAGS) + list(APPEND CMAKE_EXE_LINKER_FLAGS "${FLTK_EXE_LINKER_FLAGS}") +endif(FLTK_EXE_LINKER_FLAGS) diff --git a/CMake/cmake_uninstall.cmake.in b/CMake/cmake_uninstall.cmake.in new file mode 100644 index 000000000..ed3a5bdfd --- /dev/null +++ b/CMake/cmake_uninstall.cmake.in @@ -0,0 +1,19 @@ +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR + "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") + +foreach(file ${files}) +message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + exec_program("@CMAKE_COMMAND@" + ARGS "-E remove -f \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif(NOT "${rm_retval}" STREQUAL 0) +endforeach(file) diff --git a/CMake/posixScandir.cxx b/CMake/posixScandir.cxx new file mode 100644 index 000000000..ea57e9ce2 --- /dev/null +++ b/CMake/posixScandir.cxx @@ -0,0 +1,10 @@ + +#include <dirent.h> + +int func (const char *d, dirent ***list, void *sort) { + int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort); +} + +int main() { + return 0; +} |
