mirror of
https://github.com/fltk/fltk.git
synced 2026-06-08 01:46:00 +08:00
Add forgotten file for CMake enhancements (STR #3055).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10343 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
#
|
||||
# "$Id: CMakeLists.txt 10092 2014-02-02 00:49:50Z AlbrechtS $"
|
||||
#
|
||||
# macros.cmake defines macros used by the build system
|
||||
# Written by Michael Surette
|
||||
#
|
||||
# Copyright 1998-2010 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
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
# macros used by the build system
|
||||
#######################################################################
|
||||
macro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
||||
|
||||
if(${LIBTYPE} STREQUAL "SHARED")
|
||||
set(LIBRARY_NAME ${LIBNAME}_SHARED)
|
||||
else()
|
||||
set(LIBRARY_NAME ${LIBNAME})
|
||||
endif(${LIBTYPE} STREQUAL "SHARED")
|
||||
|
||||
add_library(${LIBRARY_NAME} ${LIBTYPE} ${LIBFILES})
|
||||
|
||||
set_target_properties(${LIBRARY_NAME}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${LIBNAME}
|
||||
DEBUG_OUTPUT_NAME "${LIBNAME}d"
|
||||
CLEAN_DIRECT_OUTPUT TRUE
|
||||
COMPILE_DEFINITIONS "FL_LIBRARY"
|
||||
)
|
||||
|
||||
if(${LIBTYPE} STREQUAL "SHARED")
|
||||
set_target_properties(${LIBRARY_NAME}
|
||||
PROPERTIES
|
||||
VERSION ${FLTK_VERSION_FULL}
|
||||
SOVERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
|
||||
PREFIX "lib" # for MSVC static/shared coexistence
|
||||
)
|
||||
endif(${LIBTYPE} STREQUAL "SHARED")
|
||||
|
||||
if(MSVC)
|
||||
if(OPTION_LARGE_FILE)
|
||||
set_target_properties(${LIBNAME}
|
||||
PROPERTIES
|
||||
LINK_FLAGS /LARGEADDRESSAWARE
|
||||
)
|
||||
endif(OPTION_LARGE_FILE)
|
||||
|
||||
if(${LIBTYPE} STREQUAL "SHARED")
|
||||
set_target_properties(${LIBRARY_NAME}
|
||||
PROPERTIES
|
||||
COMPILE_DEFINITIONS "FL_DLL"
|
||||
)
|
||||
endif(${LIBTYPE} STREQUAL "SHARED")
|
||||
endif(MSVC)
|
||||
|
||||
install(TARGETS ${LIBRARY_NAME}
|
||||
EXPORT FLTK-Targets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
list(APPEND FLTK_LIBRARIES "${LIBRARY_NAME}")
|
||||
set(FLTK_LIBRARIES ${FLTK_LIBRARIES} PARENT_SCOPE)
|
||||
|
||||
endmacro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
||||
|
||||
#######################################################################
|
||||
macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
||||
|
||||
set(srcs)
|
||||
set(flsrcs)
|
||||
foreach(src ${SOURCES})
|
||||
if("${src}" MATCHES ".fl$")
|
||||
list(APPEND flsrcs ${src})
|
||||
else()
|
||||
list(APPEND srcs ${src})
|
||||
endif("${src}" MATCHES ".fl$")
|
||||
endforeach(src)
|
||||
|
||||
if(flsrcs)
|
||||
set(FLTK_WRAP_UI TRUE)
|
||||
fltk_wrap_ui(${NAME} ${flsrcs})
|
||||
endif(flsrcs)
|
||||
|
||||
add_executable(${NAME} WIN32 ${srcs} ${${NAME}_FLTK_UI_SRCS})
|
||||
|
||||
target_link_libraries(${NAME} ${LIBRARIES})
|
||||
|
||||
# link in optional libraries
|
||||
if(USE_XFT)
|
||||
target_link_libraries(${NAME} ${X11_Xft_LIB})
|
||||
endif(USE_XFT)
|
||||
|
||||
if(HAVE_XINERAMA)
|
||||
target_link_libraries(${NAME} ${X11_Xinerama_LIB})
|
||||
endif(HAVE_XINERAMA)
|
||||
|
||||
# install the example
|
||||
install(TARGETS ${NAME}
|
||||
DESTINATION ${FLTK_EXAMPLES_PATH}
|
||||
)
|
||||
|
||||
endmacro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
||||
|
||||
#######################################################################
|
||||
Reference in New Issue
Block a user