summaryrefslogtreecommitdiff
path: root/CMake/variables.cmake
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2015-04-25 13:50:27 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2015-04-25 13:50:27 +0000
commite23bf0b768531c31d344cbb1b1a034f8e9de664d (patch)
tree039a5b912a077d5656691b79bf82c7440f1e42cc /CMake/variables.cmake
parentd2b7b5b24a65772e08ba6da6b559f770c7fcb4af (diff)
[CMake] Fix CMake build's fltk-config (STR #3217).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10716 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'CMake/variables.cmake')
-rw-r--r--CMake/variables.cmake81
1 files changed, 81 insertions, 0 deletions
diff --git a/CMake/variables.cmake b/CMake/variables.cmake
new file mode 100644
index 000000000..e161ef9e9
--- /dev/null
+++ b/CMake/variables.cmake
@@ -0,0 +1,81 @@
+#
+# "$Id$"
+#
+# This file sets variables for common use in export.cmake and install.cmake
+# Written by Michael Surette
+#
+# Copyright 1998-2015 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
+# file is missing or damaged, see the license at:
+#
+# http://www.fltk.org/COPYING.php
+#
+# Please report all bugs and problems on the following page:
+#
+# http://www.fltk.org/str.php
+#
+
+#######################################################################
+set(FL_MAJOR_VERSION ${FLTK_VERSION_MAJOR})
+set(FL_MINOR_VERSION ${FLTK_VERSION_MINOR})
+set(FL_PATCH_VERSION ${FLTK_VERSION_PATCH})
+
+#######################################################################
+# add several libraries (STR #3011)
+# FIXME: libraries may need reordering, and this version does not yet
+# correctly support static linking and local zlib, png, and jpeg libs.
+
+if(LIB_fontconfig)
+ list(APPEND FLTK_LDLIBS -lfontconfig)
+endif(LIB_fontconfig)
+
+if(HAVE_DLSYM)
+ list(APPEND FLTK_LDLIBS -ldl)
+endif(HAVE_DLSYM)
+
+if(LIB_png)
+ list(APPEND IMAGELIBS -lpng)
+endif(LIB_png)
+
+if(LIB_zlib)
+ list(APPEND IMAGELIBS -lz)
+endif(LIB_zlib)
+
+if(LIB_jpeg)
+ list(APPEND IMAGELIBS -ljpeg)
+endif(LIB_jpeg)
+
+string(REPLACE ";" " " IMAGELIBS "${IMAGELIBS}")
+set(STATICIMAGELIBS "${IMAGELIBS}")
+
+#######################################################################
+set(CC ${CMAKE_C_COMPILER})
+set(CXX ${CMAKE_CXX_COMPILER})
+
+set(ARCHFLAGS ${OPTION_ARCHFLAGS})
+
+string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_UPPER)
+if(${BUILD_UPPER})
+ set(CFLAGS "${CMAKE_C_FLAGS_${BUILD_UPPER}} ${CFLAGS}")
+endif(${BUILD_UPPER})
+set(CFLAGS "${OPTION_OPTIM} ${CMAKE_C_FLAGS} ${CFLAGS}")
+foreach(arg ${FLTK_CFLAGS})
+ set(CFLAGS "${CFLAGS} ${arg}")
+endforeach(arg ${FLTK_CFLAGS})
+
+set(CXXFLAGS ${CFLAGS})
+
+foreach(arg ${FLTK_LDLIBS})
+ set(LINK_LIBS "${LINK_LIBS} ${arg}")
+endforeach(arg ${FLTK_LDLIBS})
+
+set(LIBS ${LINK_LIBS})
+
+# FIXME: The only case `configure' would set the "SHAREDSUFFIX"
+# variable is to "_s" if OS == "aix", hence we do NOT (yet) set it here.
+# This is for fltk-config only, so it doesn't matter much anyway.
+# ${CMAKE_SHARED_LIBRARY_SUFFIX} would be ".so" under Linux.
+# * do not * set(SHAREDSUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
+set(SHAREDSUFFIX "")