root/OpenSceneGraph/branches/OpenSceneGraph-2.8/CMakeLists.txt @ 10038

Revision 10038, 35.4 kB (checked in by robert, 6 years ago)

Updated dates for 2.8.1-rc2

  • Property svn:eol-style set to native
Line 
1IF(WIN32)
2    CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
3ELSE(WIN32)
4    IF(APPLE)
5        CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
6    ELSE(APPLE)
7        CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0 FATAL_ERROR)
8    ENDIF(APPLE)
9ENDIF(WIN32)
10
11if(COMMAND cmake_policy)
12    # Works around warnings libraries linked against that don't
13    # have absolute paths (e.g. -lpthreads)
14    cmake_policy(SET CMP0003 NEW)
15
16    # Works around warnings about escaped quotes in ADD_DEFINITIONS
17    # statements.
18    cmake_policy(SET CMP0005 NEW)
19
20    # cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
21    # quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
22    if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
23        cmake_policy(SET CMP0008 OLD)
24    endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
25endif(COMMAND cmake_policy)
26
27PROJECT(OpenSceneGraph)
28
29SET(OPENSCENEGRAPH_MAJOR_VERSION 2)
30SET(OPENSCENEGRAPH_MINOR_VERSION 8)
31SET(OPENSCENEGRAPH_PATCH_VERSION 1)
32SET(OPENSCENEGRAPH_SOVERSION 55)
33
34# set to 0 when not a release candidate, non zero means that any generated
35# svn tags will be treated as release candidates of given number
36SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 2)
37
38SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
39
40SET(OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_VERSION})
41
42SET(OSG_PLUGIN_PREFIX "")
43
44IF (CYGWIN)
45    SET(OSG_PLUGIN_PREFIX "cygwin_")
46ENDIF(CYGWIN)
47
48IF(MINGW)
49    SET(OSG_PLUGIN_PREFIX "mingw_")
50ENDIF(MINGW)
51
52
53# We want to build SONAMES shared librariess
54SET(OPENSCENEGRAPH_SONAMES TRUE)
55SET(OPENTHREADS_SONAMES TRUE)
56
57SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})
58
59# We have some custom .cmake scripts not in the official distribution.
60# Maybe this can be used override existing behavior if needed?
61SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
62
63
64# Okay, here's the problem: On some platforms, linking against OpenThreads
65# is not enough and explicit linking to the underlying thread library
66# is also required (e.g. FreeBSD). But OpenThreads may be built with different
67# backends (Pthreads, Sproc, Windows) so we don't know what the underlying
68# thread library is because some platforms support multiple backends (e.g.
69# IRIX supports Sproc and Pthreads). Linking all libraries won't work
70# because the libraries may be incompatible.
71# So the current solution is to attempt best guess linking and exempt certain
72# cases. With IRIX, we're going to hope explicit linking to the underlying
73# library is not necessary. We currently don't case for pthreads on Windows
74# which might be an issue on things like Cygwin. This may need to be fixed.
75FIND_PACKAGE(Threads)
76IF(CMAKE_SYSTEM MATCHES IRIX)
77    # Erase CMAKE_THREAD_LIBS_INIT and hope it works
78    SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
79ENDIF(CMAKE_SYSTEM MATCHES IRIX)
80
81OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
82IF (OSG_MAINTAINER)
83
84    #SET(OPENSCENEGRAPH_SVN "trunk")
85    SET(OPENSCENEGRAPH_SVN "branches")
86
87    SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
88
89    #
90    # Provide target for tagging a release
91    #
92    SET(SVNCOMMAND svn)
93    SET(SVNTRUNKDIR     http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk)
94    SET(SVNTAGDIR       http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags)
95    SET(SVNBRANCHDIR    http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches)
96
97    IF   (OPENSCENEGRAPH_SVN STREQUAL "trunk")
98        SET(SVNSOURCEDIR ${SVNTRUNKDIR})
99    ELSE (OPENSCENEGRAPH_SVN STREQUAL "trunk")
100        SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
101    ENDIF(OPENSCENEGRAPH_SVN STREQUAL "trunk")
102
103
104    IF   (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
105        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
106    ELSE (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
107        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
108    ENDIF(OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
109
110
111    ADD_CUSTOM_TARGET(tag-test
112        COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
113    )
114
115    ADD_CUSTOM_TARGET(tag-run
116        COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
117    )
118
119    ADD_CUSTOM_TARGET(branch-test
120        COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
121    )
122
123    ADD_CUSTOM_TARGET(branch-run
124        COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
125    )
126
127    #
128    # Provide target for generating ChangeLog
129    #
130    SET(GENERATELOGS svn2cl)
131
132    ADD_CUSTOM_TARGET(ChangeLog
133        COMMAND ${SVNCOMMAND} update
134        COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
135    )
136   
137ENDIF(OSG_MAINTAINER)
138
139
140# Find OpenGL
141FIND_PACKAGE(OpenGL)
142
143IF(APPLE)
144    FIND_LIBRARY(CARBON_LIBRARY Carbon)
145    FIND_LIBRARY(COCOA_LIBRARY Cocoa)
146ENDIF(APPLE)
147
148IF(UNIX)
149    # Not sure what this will do on Cygwin and Msys
150    # Also, remember OS X X11 is a user installed option so it may not exist.
151    FIND_PACKAGE(X11)
152    # Some Unicies need explicit linkage to the Math library or the build fails.
153    FIND_LIBRARY(MATH_LIBRARY m)
154ENDIF(UNIX)
155
156# Make the headers visible to everything
157IF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
158   INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include)
159ENDIF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
160
161INCLUDE_DIRECTORIES(
162    ${OpenSceneGraph_SOURCE_DIR}/include
163    ${OPENGL_INCLUDE_DIR}
164)
165
166# Common global definitions
167#ADD_DEFINITIONS(-D)
168# Platform specific definitions
169
170
171IF(WIN32)
172
173    IF(MSVC)
174        # This option is to enable the /MP switch for Visual Studio 2005 and above compilers
175        OPTION(WIN32_USE_MP "Set to ON to build OpenSceneGraph with the /MP option (Visual Studio 2005 and above)." OFF)
176        MARK_AS_ADVANCED(WIN32_USE_MP)
177        IF(WIN32_USE_MP)
178            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
179        ENDIF(WIN32_USE_MP)
180
181        # turn off various warnings
182        # foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
183        #     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${warning}")
184        # endforeach(warning)
185
186        # More MSVC specific compilation flags
187        ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
188        ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
189    ENDIF(MSVC)
190
191    #needed for net plugin
192    SET (OSG_SOCKET_LIBS wsock32)
193    # Both Cygwin and Msys need -DNOMINMAX ???
194    IF(UNIX)
195        ADD_DEFINITIONS(-DNOMINMAX)
196    ENDIF(UNIX)
197########################################################################################################
198# the following options are MSVC specific,
199# the first OSG_MSVC_VERSIONED_DLL activate a custom build-time layout that should allow to run examples and application
200# fron bin folder without requiring installation step.
201# it also prepend "osg${OPENSCENEGRAPH_SOVERSION}-" to only .dll files, leaving .lib files untouched in lib
202# it also use a hack to get rid of Debug and Release folder in MSVC projects
203# all the .dll and .pdb are in bin and all the .lib and .exp are in lib
204#
205# the second option disable incremental linking in debug build , that is enabled by default by CMake
206##########################################################################################################
207
208    IF(MSVC)
209        IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
210            MESSAGE("Warning:  disabling versioned options 2.4.6 exibits inconsintencies in .pdb naming, at least under MSVC, suggested upgrading at least to 2.4.7")
211            SET(OSG_MSVC_VERSIONED_DLL OFF)
212            SET(OSG_MSVC_DEBUG_INCREMENTAL_LINK ON)
213        ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
214            OPTION(OSG_MSVC_VERSIONED_DLL "Set to ON to build OpenSceneGraph with versioned dll names" ON)
215            MARK_AS_ADVANCED(OSG_MSVC_VERSIONED_DLL)
216            OPTION(OSG_MSVC_DEBUG_INCREMENTAL_LINK "Set to OFF to build OpenSceneGraph without incremental linking in debug (release is off by default)" ON)
217            MARK_AS_ADVANCED(OSG_MSVC_DEBUG_INCREMENTAL_LINK)
218            IF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
219                SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
220                SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
221                SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
222            ENDIF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
223        ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
224    ENDIF(MSVC)
225ENDIF(WIN32)
226
227########################################################################################################
228##### these were settings located in SetupCommon.cmake used in Luigi builds.... find out what are useful
229########################################################################################################
230#luigi#SET(CMAKE_VERBOSE_MAKEFILE TRUE)
231#luigi#SET(CMAKE_SKIP_RPATH TRUE)
232#luigi#SET(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
233#luigi#IF(UNIX)
234#luigi#    LIST_CONTAINS(contains "g++" ${CMAKE_CXX_COMPILER_LIST})
235#luigi#    IF (contains)
236#luigi#        MESSAGE(${MY_MESSAGE_DEFAULT} "${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} setting  CMAKE_CXX_COMPILER to g++")
237#luigi#        SET(CMAKE_CXX_COMPILER "g++")
238#luigi#        SET(CMAKE_CXX_COMPILER_LOADED 2)
239#luigi#        SET(CMAKE_CXX_COMPILER_WORKS 2)
240#luigi#    ENDIF (contains)
241#luigi#    SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
242#luigi#    SET(CMAKE_CXX_FLAGS_DEBUG "-ggdb -gstabs")
243#luigi#ENDIF(UNIX)
244########################################################################################################
245
246OPTION(OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float Matrix instead of double." OFF)
247MARK_AS_ADVANCED(OSG_USE_FLOAT_MATRIX)
248
249OPTION(OSG_USE_FLOAT_PLANE "Set to ON to build OpenSceneGraph with float Plane instead of double." OFF)
250MARK_AS_ADVANCED(OSG_USE_FLOAT_PLANE)
251
252OPTION(OSG_USE_FLOAT_BOUNDINGSPHERE "Set to ON to build OpenSceneGraph with float BoundingSphere instead of double." ON)
253MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGSPHERE)
254
255OPTION(OSG_USE_FLOAT_BOUNDINGBOX "Set to ON to build OpenSceneGraph with float BoundingBox instead of double." ON)
256MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGBOX)
257
258OPTION(OSG_USE_UTF8_FILENAME "Set to ON to use a UTF8 locale for filenames instead of the default locale." OFF)
259MARK_AS_ADVANCED(OSG_USE_UTF8_FILENAME)
260
261OPTION(OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC warnings generated by OSG headers." ON)
262MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
263
264OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
265
266################################################################################
267# Set Config file
268
269SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
270CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
271               "${OPENSCENEGRAPH_CONFIG_HEADER}")
272# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")
273
274
275################################################################################
276# Optional build components
277
278# OSG Applications
279OPTION(BUILD_OSG_APPLICATIONS "Enable to build OSG Applications (e.g. osgviewer)" ON)
280
281# OSG Examples
282OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF)
283
284################################################################################
285# 3rd Party Dependency Stuff
286IF(WIN32)
287    INCLUDE(Find3rdPartyDependencies)
288ENDIF(WIN32)
289
290# Common to all platforms:
291FIND_PACKAGE(FreeType)
292FIND_PACKAGE(Inventor)
293FIND_PACKAGE(Jasper)
294FIND_PACKAGE(OpenEXR)
295FIND_PACKAGE(COLLADA)
296FIND_PACKAGE(ZLIB)
297FIND_PACKAGE(Xine)
298FIND_PACKAGE(OpenVRML)
299FIND_PACKAGE(Performer)
300FIND_PACKAGE(GDAL)
301FIND_PACKAGE(CURL)
302FIND_PACKAGE(ITK)
303FIND_PACKAGE(LibVNCServer)
304FIND_PACKAGE(OurDCMTK)
305FIND_PACKAGE(XUL)
306
307#use pkg-config to find various modues
308INCLUDE(FindPkgConfig OPTIONAL)
309
310IF(PKG_CONFIG_FOUND)
311
312    INCLUDE(FindPkgConfig)
313
314    PKG_CHECK_MODULES(GTK gtk+-2.0)
315
316    IF(WIN32)
317        PKG_CHECK_MODULES(GTKGL gtkglext-win32-1.0)
318    ELSE(WIN32)
319        PKG_CHECK_MODULES(GTKGL gtkglext-x11-1.0)
320    ENDIF(WIN32)
321
322    PKG_CHECK_MODULES(RSVG librsvg-2.0)
323    PKG_CHECK_MODULES(CAIRO cairo)
324    PKG_CHECK_MODULES(POPPLER poppler-glib)
325
326ENDIF(PKG_CONFIG_FOUND)
327
328#optional example related dependencies
329IF   (BUILD_OSG_EXAMPLES)
330
331
332    FIND_PACKAGE(FLTK)
333    FIND_PACKAGE(GLUT)
334    FIND_PACKAGE(SDL)
335    FIND_PACKAGE(FOX)
336
337    SET(wxWidgets_USE_LIBS base core gl net)
338    FIND_PACKAGE(wxWidgets)
339
340    # To select a specific version of QT define DESIRED_QT_VERSION
341    # via cmake -DDESIRED_QT_VERSION=4
342    IF  (DESIRED_QT_VERSION)
343
344        IF  (DESIRED_QT_VERSION MATCHES 4)
345          FIND_PACKAGE(Qt4)
346        ELSE(DESIRED_QT_VERSION MATCHES 4)
347          FIND_PACKAGE(Qt3)
348        ENDIF(DESIRED_QT_VERSION MATCHES 4)
349
350    ELSE(DESIRED_QT_VERSION)
351
352        FIND_PACKAGE(Qt4)
353
354        IF  (NOT QT4_FOUND)
355            FIND_PACKAGE(Qt3)
356        ENDIF(NOT QT4_FOUND)
357
358    ENDIF(DESIRED_QT_VERSION)
359
360ENDIF(BUILD_OSG_EXAMPLES)
361
362
363
364
365
366
367#
368# Test to determine if we want the "tripledot" form of the GLU tesselator callback.
369#
370IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
371    IF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
372
373        # Skip the compile check for platforms that never need the variable
374        # form.
375        SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT false)
376
377    ELSE(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
378
379        # For other platforms perform the check
380        INCLUDE(CheckCXXSourceCompiles)
381        SET(CMAKE_REQUIRED_DEFINITIONS -DGLU_TESS_CALLBACK_TRIPLEDOT)
382        SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include ${GLUT_INCLUDE_DIR} ${GL_INCLUDE_DIR})
383        SET(CMAKE_REQUIRED_LIBRARIES ${GLUT_LIBRARY} ${GL_LIBRARY})
384        CHECK_CXX_SOURCE_COMPILES(
385            "#include <osg/GL>
386            #include <osg/GLU>
387            static void testcb(GLvoid *, void*) { }
388            int main() {
389               GLUtesselator *t = gluNewTess();
390               gluTessCallback(t, GLU_TESS_VERTEX_DATA, (GLU_TESS_CALLBACK) testcb);
391               return 0;
392            }"
393            GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No)
394        SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT
395            ${GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No})
396
397    ENDIF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
398ENDIF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
399
400OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build with variable parameter (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT})
401IF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
402    ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT)
403ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
404
405# Platform specific:
406# (We can approach this one of two ways. We can try to FIND everything
407# and simply check if we found the packages before actually building
408# or we can hardcode the cases. The advantage of the former is that
409# packages that are installed on platforms that don't require them
410# will still get built (presuming no compatibility issues). But this
411# also means modules that are redundant may get built. For example,
412# OS X doesn't need GIF, JPEG, PNG, TIFF, etc because it uses QuickTime.
413# Also, it will clutter the CMake menu with "NOT_FOUND".
414# The downside to the latter is that it is harder to build those
415# potentially redundant modules.)
416
417# Image readers/writers depend on 3rd party libraries except for OS X which
418# can use Quicktime.
419IF(NOT APPLE)
420    FIND_PACKAGE(GIFLIB)
421    FIND_PACKAGE(JPEG)
422    FIND_PACKAGE(PNG)
423    FIND_PACKAGE(TIFF)
424
425    # QuickTime is required for OS X, but optional for Windows.
426    IF(WIN32)
427        FIND_PACKAGE(QuickTime)
428    ENDIF(WIN32)
429
430ELSE(NOT APPLE)
431    FIND_PACKAGE(QuickTime)
432ENDIF(NOT APPLE)
433
434################################################################################
435# Create bin and lib directories if required
436
437IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
438   FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin ${CMAKE_BINARY_DIR}/lib ${CMAKE_BINARY_DIR}/lib/${OSG_PLUGINS})
439ENDIF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
440
441
442################################################################################
443# Installation stuff
444
445SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
446ADD_DEFINITIONS(-DOSG_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX})
447
448IF(UNIX AND NOT WIN32)
449  IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
450    ADD_DEFINITIONS("-D_DEBUG")
451  ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
452ENDIF(UNIX AND NOT WIN32)
453
454IF(CYGWIN)
455  IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
456    ADD_DEFINITIONS("-D_DEBUG")
457  ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
458ENDIF(CYGWIN)
459
460IF(UNIX AND NOT WIN32 AND NOT APPLE)
461  IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
462      SET(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement")
463      MARK_AS_ADVANCED(LIB_POSTFIX)
464  ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8")
465ENDIF(UNIX AND NOT WIN32 AND NOT APPLE)
466IF(NOT DEFINED LIB_POSTFIX)
467    SET(LIB_POSTFIX "")
468ENDIF(NOT DEFINED LIB_POSTFIX)
469
470# Here we apparantly do some funky stuff with making the bin/ and lib/
471# folders which is probably needed to work around a very old CMake bug?
472
473#SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME})
474SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin)
475MAKE_DIRECTORY(${OUTPUT_BINDIR})
476IF(MSVC AND NOT MSVC_IDE)
477    MAKE_DIRECTORY(${OUTPUT_BINDIR}/${OSG_PLUGINS})
478ENDIF(MSVC AND NOT MSVC_IDE)
479
480#SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME})
481SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib)
482MAKE_DIRECTORY(${OUTPUT_LIBDIR})
483IF(NOT MSVC)
484    MAKE_DIRECTORY(${OUTPUT_LIBDIR}/${OSG_PLUGINS})
485ENDIF(NOT MSVC)
486
487# On CMake 2.4.x use EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH and later
488# we work around the DLL placement by use of the PREFIX target property hack
489#
490# On CMake 2.6.x use the newly minted CMAKE_LIBRARY_OUTPUT_DIRECTORY,
491# CMAKE_ARCHIVE_OUTPUT_DIRECTORY & CMAKE_RUNTIME_OUTPUT_DIRECTORY
492
493IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
494    # If CMake >= 2.6.0
495    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
496    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
497    IF(WIN32)
498        SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
499    ELSE(WIN32)
500        SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
501    ENDIF(WIN32)
502ELSE(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
503    SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
504    SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})
505ENDIF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
506
507#SET(INSTALL_BINDIR OpenSceneGraph/bin)
508#SET(INSTALL_INCDIR OpenSceneGraph/include)
509#SET(INSTALL_LIBDIR OpenSceneGraph/lib)
510#SET(INSTALL_DOCDIR OpenSceneGraph/doc)
511
512################################################################################
513# User Options
514
515
516# Expose CMAKE_INCLUDE_PATH and CMAKE_LIBARY_PATH to the GUI so users
517# may set these values without needing to manipulate the environment.
518SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
519SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
520# We are proposing that a new variable called CMAKE_PREFIX_PATH be introduced
521# to CMake to compliment CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH.
522# A formal feature request has been submited to CMake, Bug #4947.
523# It is intended for those users who have common prefixes for their INCLUDE
524# and LIBRARY locations. So if users have headers in /usr/local/include
525# and libraries in /usr/local/lib, the common prefix is /usr/local.
526# It should also cover the case where headers and libraries are
527# in the same directory.
528# Our proposal expects that FIND_* commands will automatically search for
529# CMAKE_PREFIX_PATH right after CMAKE_INCLUDE_PATH or CMAKE_LIBRARY_PATH.
530# Obviously, since CMake does not currently support this, we must write
531# our Find*.cmake modules to explicitly support this. Otherwise, this variable
532# will have no impact.
533# This is unofficial so this may be removed or changed at anytime.
534SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "(EXPERIMENTAL) You may add additional search paths here. Use ; to separate multiple paths.")
535
536# This is for an advanced option to give aggressive warnings
537# under different compilers. If yours is not implemented, this option
538# will not be made available.
539IF(CMAKE_COMPILER_IS_GNUCXX)
540    # To be complete, we might also do GNUCC flags,
541    # but everything here is C++ code.
542    # -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG
543    # returns too many hits.
544    # FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
545    # interesting C-specific flag.
546    # Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
547    # errors instead of warnings for certain issues, including superfluous
548    # semicolons and commas, and the use of long long. -fpermissive seems
549    # to be the workaround.
550    SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive)
551
552    # Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
553
554
555ELSE(CMAKE_COMPILER_IS_GNUCXX)
556    IF(MSVC)
557        # FIXME: What are good aggressive warning flags for Visual Studio?
558        # And do we need to further subcase this for different versions of VS?
559        # CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
560        SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)
561
562
563    ELSE(MSVC)
564        # CMake lacks an elseif, so other non-gcc, non-VS compilers need
565        # to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
566        # remain unset.
567    ENDIF(MSVC)
568ENDIF(CMAKE_COMPILER_IS_GNUCXX)
569
570# This part is for the CMake menu option to toggle the warnings on/off.
571# This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS.
572IF(OSG_AGGRESSIVE_WARNING_FLAGS)
573
574    IF (APPLE)
575        SET(DEFAULT_USE_AGGRESSIVE_WARNINGS OFF)
576    ELSE(APPLE)
577        SET(DEFAULT_USE_AGGRESSIVE_WARNINGS ON)
578    ENDIF(APPLE)
579
580    OPTION(OSG_USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" ${DEFAULT_USE_AGGRESSIVE_WARNINGS})
581    MARK_AS_ADVANCED(OSG_USE_AGGRESSIVE_WARNINGS)
582
583    IF(OSG_USE_AGGRESSIVE_WARNINGS)
584        # Add flags defined by OSG_AGGRESSIVE_WARNING_FLAGS if they aren't already there
585        FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
586            IF(NOT CMAKE_CXX_FLAGS MATCHES "${flag}")
587                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
588            ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "${flag}")
589        ENDFOREACH(flag)
590    ELSE(OSG_USE_AGGRESSIVE_WARNINGS)
591        # Remove all flags considered aggresive
592        FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
593            STRING(REGEX REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
594        ENDFOREACH(flag)
595    ENDIF(OSG_USE_AGGRESSIVE_WARNINGS)
596ENDIF(OSG_AGGRESSIVE_WARNING_FLAGS)
597
598
599# Dynamic vs Static Linking
600OPTION(DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking.  Use OFF for static." ON)
601IF   (DYNAMIC_OPENSCENEGRAPH)
602    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
603ELSE (DYNAMIC_OPENSCENEGRAPH)
604    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
605ENDIF(DYNAMIC_OPENSCENEGRAPH)
606
607INCLUDE(OsgMacroUtils)
608# OSG Core
609ADD_SUBDIRECTORY(src)
610
611IF   (BUILD_OSG_APPLICATIONS)
612    ADD_SUBDIRECTORY(applications)
613ENDIF(BUILD_OSG_APPLICATIONS)
614
615IF   (BUILD_OSG_EXAMPLES)
616    ADD_SUBDIRECTORY(examples)
617ENDIF(BUILD_OSG_EXAMPLES)
618
619
620# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
621# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
622IF(APPLE)
623    # These are just defaults/recommendations, but how we want to build
624    # out of the box. But the user needs to be able to change these options.
625    # So we must only set the values the first time CMake is run, or we
626    # will overwrite any changes the user sets.
627    # FORCE is used because the options are not reflected in the UI otherwise.
628    # Seems like a good place to add version specific compiler flags too.
629    IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
630        # This is really fragile, but CMake doesn't provide the OS system
631        # version information we need. (Darwin versions can be changed
632        # independently of OS X versions.)
633        # It does look like CMake handles the CMAKE_OSX_SYSROOT automatically.
634        IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
635            # 64-bit compiles are not supported with Carbon. We should enable
636            # 64-bit compilation by default once osgviewer has been
637            # rewritten with Cocoa.
638            #SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
639            SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
640            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
641        ELSE(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
642            IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
643                SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
644                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
645            ELSE(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
646                # No Universal Binary support
647                # Should break down further to set the -mmacosx-version-min,
648                # but the SDK detection is too unreliable here.
649            ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
650        ENDIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
651    ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
652
653    OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
654
655ENDIF(APPLE)
656
657
658#
659# Provide target for generating wrappers
660#
661SET(GENWRAPPER genwrapper)
662
663ADD_CUSTOM_TARGET(wrappers
664    COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -t ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/Doxyfile.template -d ${OpenSceneGraph_SOURCE_DIR} | doxygen -
665    COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -l ${OpenSceneGraph_SOURCE_DIR}
666)
667
668# For Doxygen
669INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
670OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
671MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION)
672# To build the documention, you will have to enable it
673# and then do the equivalent of "make DoxygenDoc".
674IF(BUILD_DOCUMENTATION)
675
676    OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
677    IF(BUILD_REF_DOCS_SEARCHENGINE)
678        SET(SEARCHENGINE YES)
679    ELSE(BUILD_REF_DOCS_SEARCHENGINE)
680        SET(SEARCHENGINE NO)
681    ENDIF(BUILD_REF_DOCS_SEARCHENGINE)
682
683    OPTION(BUILD_REF_DOCS_TAGFILE "Generate a tag file named osg.tag on the documentation web server" OFF)
684    IF(BUILD_REF_DOCS_TAGFILE)
685        SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg.tag")
686    ELSE(BUILD_REF_DOCS_TAGFILE)
687        SET(GENERATE_TAGFILE "")
688    ENDIF(BUILD_REF_DOCS_TAGFILE)
689
690    IF(DOT)
691        SET(HAVE_DOT YES)
692    ELSE(DOT)
693        SET(HAVE_DOT NO)
694    ENDIF(DOT)
695   
696    # If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
697    SET(GENERATE_HTMLHELP "NO")
698    IF(DOCUMENTATION_HTML_HELP)
699        # on windows Documentation.cmake finds the html help workshop fi it exists. On u*ix we might have it with wine but no way to point it out
700        IF(NOT WIN32)
701            SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
702            MARK_AS_ADVANCED(HTML_HELP_COMPILER)
703        ENDIF(NOT WIN32)
704        # this var sets a proper value in .doxygen files when coniguring them below
705        SET(GENERATE_HTMLHELP "YES")
706    endif(DOCUMENTATION_HTML_HELP)
707 
708    # This processes our doxyfile.cmake and substitutes paths to generate
709    # a final Doxyfile
710    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/doxyfile.cmake
711        ${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
712    )
713    # copy the osg logo to documentations target folder
714    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
715        ${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg32-32.png COPYONLY
716    )
717    #INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
718    INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs DESTINATION doc COMPONENT openscenegraph-doc)
719
720    # now set up openthreads documentation generation
721    IF(BUILD_REF_DOCS_TAGFILE)
722        SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenThreadsReferenceDocs/ot.tag")
723    ENDIF(BUILD_REF_DOCS_TAGFILE)
724
725    # This processes our openthreads.doxyfile.cmake and generate a final doxyfile
726    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/openthreads.doxyfile.cmake
727        ${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
728    )
729    # copy the osg logo to documentations target folder
730    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
731        ${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs/osg32-32.png COPYONLY
732    )
733    #INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
734    INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs DESTINATION doc COMPONENT openthreads-doc)
735
736    # Process our other doxyfiles but don't create targets for these
737    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/all_Doxyfile
738        ${PROJECT_BINARY_DIR}/doc/all_Doxyfile)
739    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/auto_Doxyfile
740        ${PROJECT_BINARY_DIR}/doc/auto_Doxyfile)
741    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/core_Doxyfile
742        ${PROJECT_BINARY_DIR}/doc/core_Doxyfile)
743   
744    # This creates a new target to build documentation.
745    # It runs ${DOXYGEN} which is the full path and executable to
746    # Doxygen on your system, set by the FindDoxygen.cmake module
747    # (called by FindDocumentation.cmake).
748    # It runs the final generated Doxyfile against it.
749    # The DOT_PATH is substituted into the Doxyfile.
750    ADD_CUSTOM_TARGET(doc_openscenegraph ${DOXYGEN}
751        ${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
752    )
753    ADD_CUSTOM_TARGET(doc_openthreads ${DOXYGEN}
754        ${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
755    )
756ENDIF(BUILD_DOCUMENTATION)
757
758OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph" OFF)
759IF(BUILD_DASHBOARD_REPORTS)
760# The following are required to uses Dart and the Cdash dashboard
761# viewable here : http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph
762    INCLUDE(Dart)
763ENDIF(BUILD_DASHBOARD_REPORTS)
764
765# present the packaging option only if we have the cpack command defined (effectively >= 2.6.0)
766IF(CMAKE_CPACK_COMMAND)
767    OPTION(BUILD_OSG_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
768    IF(BUILD_OSG_PACKAGES)
769      INCLUDE(OsgCPack)
770    ENDIF(BUILD_OSG_PACKAGES)
771ENDIF(CMAKE_CPACK_COMMAND)
772
773# Generate pkg-config configuration file
774
775CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/openscenegraph.pc.in
776        ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openscenegraph.pc
777    @ONLY
778    )
779
780INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openscenegraph.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig COMPONENT libopenscenegraph-dev)
781
782# Run this as late as possible so users can easier spot the message
783IF (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
784SET(REQUIRES_LIBPATH_MESSAGE ON)
785ENDIF(${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
786
787IF(REQUIRES_LIBPATH_MESSAGE)
788
789    IF (NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
790 
791        SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
792
793        MESSAGE("\nThe build system is configured to instal libraries to ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}\n"
794            "Your applications may not be able to find your installed libraries unless you:\n"
795            "    set your LD_LIBRARY_PATH (user specific) or\n"
796            "    update your ld.so configuration (system wide)")
797        IF(IS_DIRECTORY /etc/ld.so.conf.d)
798            MESSAGE("You have an ld.so.conf.d directory on your system, so if you wish to ensure that\n"
799                "applications find the installed osg libraries, system wide, you could install a\n"
800                "openscenegraph specific ld.so configuration with:\n"
801                "    sudo make install_ld_conf\n")
802            CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/ld.so.conf.d/openscenegraph.conf.in
803                ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
804            )
805            ADD_CUSTOM_TARGET(install_ld_conf ${CMAKE_COMMAND} -E copy_if_different
806                ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
807                /etc/ld.so.conf.d/openscenegraph.conf
808                COMMAND ldconfig
809                COMMENT "Copying openscenegraph.conf to /etc/ld.so.conf.d and running ldconfig"
810            )
811        ELSE(IS_DIRECTORY /etc/ld.so.conf.d)
812            IF(EXISTS /etc/ld.so.conf)
813                MESSAGE("You have an ld.so.conf file in /etc, if you wish to ensure \n"
814                "that applications find the installed osg libraries, system wide, you\n"
815                "could add ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX} to it.")
816            ENDIF(EXISTS /etc/ld.so.conf)
817        ENDIF(IS_DIRECTORY /etc/ld.so.conf.d)
818
819        # emit a message during installation.
820        INSTALL(CODE "MESSAGE(\"Libraries were installed to ${CMAKE_INSTALL_PREFIX}lib${LIB_POSTFIX}.\\nYou may need to update your ld.so configuration. \")")
821
822    ENDIF(NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
823
824ELSE(REQUIRES_LIBPATH_MESSAGE)
825
826    SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 0 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
827
828ENDIF(REQUIRES_LIBPATH_MESSAGE)
829
830
831# This needs to be run very last so other parts of the scripts can take
832# advantage of this.
833IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
834    SET(OSG_CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before")
835ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
836
837#-----------------------------------------------------------------------------
838### uninstall target
839#-----------------------------------------------------------------------------
840CONFIGURE_FILE(
841  "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
842  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
843  IMMEDIATE @ONLY)
844ADD_CUSTOM_TARGET(uninstall
845  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
Note: See TracBrowser for help on using the browser.