[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21202] branches/blender2.5/blender: CMake patch from Alexander Neundorf

Campbell Barton ideasman42 at gmail.com
Sun Jun 28 00:48:41 CEST 2009


Revision: 21202
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21202
Author:   campbellbarton
Date:     2009-06-28 00:48:39 +0200 (Sun, 28 Jun 2009)

Log Message:
-----------
CMake patch from Alexander Neundorf

-under UNIX, it uses FIND_PACKAGE() to find the jpg, png and zlib libraries

-it removes the explictely listed search paths, which are already searched by
default, so it is not necessary to list them again explicitely

-it removes the include directories /usr/include
and /usr/local/include. /usr/include is used by default, all other
directories should be searched via find_package/find_file and then added to
the include directories.

-replaces the include() commands for the FindXXX.cmake
modules with the appropriate find_package(Foo) calls.
This doesn't change the behaviour, but gives more features.
E.g. you could now say
find_package(JPEG REQUIRED)
and cmake will abort with an error if the package is not found.
Also it makes it clearer what is going on.

Additionally the patch removes the line
 INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
in the Windows if-branch.
Why was this there ? This file should be included anyway under Windows when
using the MS compiler.

Modified Paths:
--------------
    branches/blender2.5/blender/CMake/macros.cmake
    branches/blender2.5/blender/CMakeLists.txt

Modified: branches/blender2.5/blender/CMake/macros.cmake
===================================================================
--- branches/blender2.5/blender/CMake/macros.cmake	2009-06-27 21:14:04 UTC (rev 21201)
+++ branches/blender2.5/blender/CMake/macros.cmake	2009-06-27 22:48:39 UTC (rev 21202)
@@ -61,7 +61,7 @@
   SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ")
   #TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LIB} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
 
-  TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
+  TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIBRARY} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${SDL_LIB} ${LLIBS})
 
   # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
 

Modified: branches/blender2.5/blender/CMakeLists.txt
===================================================================
--- branches/blender2.5/blender/CMakeLists.txt	2009-06-27 21:14:04 UTC (rev 21201)
+++ branches/blender2.5/blender/CMakeLists.txt	2009-06-27 22:48:39 UTC (rev 21202)
@@ -89,7 +89,7 @@
 
 IF(UNIX)
   IF(WITH_OPENAL)
-    INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
+    FIND_PACKAGE(OpenAL)
     IF(OPENAL_FOUND)
       SET(WITH_OPENAL ON)
       SET(OPENAL_LIB ${OPENAL_LIBRARY})
@@ -102,22 +102,12 @@
   FIND_LIBRARY(INTL_LIBRARY
     NAMES intl
     PATHS
-    /usr/local/lib
-    /usr/lib
     /sw/lib
-    /opt/local/lib
-    /opt/csw/lib
-    /opt/lib
   )
   FIND_LIBRARY(ICONV_LIBRARY
     NAMES iconv
     PATHS
-    /usr/local/lib
-    /usr/lib
     /sw/lib
-    /opt/local/lib
-    /opt/csw/lib
-    /opt/lib
   )
   IF(INTL_LIBRARY AND ICONV_LIBRARY)
     SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
@@ -136,14 +126,14 @@
   )
   SET(FREETYPE_LIB freetype)
 
-  INCLUDE(${CMAKE_ROOT}/Modules/FindPythonLibs.cmake)
+  FIND_PACKAGE(PythonLibs)
   SET(PYTHON_INC "${PYTHON_INCLUDE_PATH}" CACHE STRING "")
   SET(PYTHON_LIB "${PYTHON_LIBRARIES}" CACHE STRING "")
-  INCLUDE(${CMAKE_ROOT}/Modules/FindPythonInterp.cmake)
+  FIND_PACKAGE(PythonInterp)
   SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
   SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
 
-  INCLUDE(${CMAKE_ROOT}/Modules/FindSDL.cmake)
+  FIND_PACKAGE(SDL)
   SET(SDL_INC ${SDL_INCLUDE_DIR})
   SET(SDL_LIB ${SDL_LIBRARY})
 
@@ -164,11 +154,11 @@
   SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
 
-  SET(JPEG_LIB jpeg)
+  FIND_PACKAGE(JPEG REQUIRED)
 
-  SET(PNG_LIB png)
+  FIND_PACKAGE(PNG REQUIRED)
 
-  SET(ZLIB_LIB z)
+  FIND_PACKAGE(ZLIB REQUIRED)
 
   SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11 -ldl")
 
@@ -186,12 +176,13 @@
   # Better warnings
   SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wnested-externs -Wdeclaration-after-statement")
 
-  INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
+  INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
 ENDIF(UNIX)
 
 IF(WIN32)
 
-  INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
+  # this file is included anyway when building under Windows with cl.exe
+  #  INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
   
   SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
 
@@ -219,15 +210,15 @@
   ENDIF(CMAKE_CL_64)
 
   IF(CMAKE_CL_64)
-  	SET(PNG_LIB libpng)
+	SET(PNG_LIBRARIES libpng)
   ELSE(CMAKE_CL_64)
-  	SET(PNG_LIB libpng_st)
+    SET(PNG_LIBRARIES libpng_st)
   ENDIF(CMAKE_CL_64)
-  SET(JPEG_LIB libjpeg)
+  SET(JPEG_LIBRARY libjpeg)
 
   SET(ZLIB ${LIBDIR}/zlib)
   SET(ZLIB_INC ${ZLIB}/include)
-  SET(ZLIB_LIB libz)
+  SET(ZLIB_LIBRARIES zlib)
   SET(ZLIB_LIBPATH ${ZLIB}/lib)
   
   SET(PTHREADS ${LIBDIR}/pthreads)
@@ -335,7 +326,7 @@
   ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
 
   IF(WITH_OPENAL)
-    INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
+    FIND_PACKAGE(OpenAL)
     IF(OPENAL_FOUND)
       SET(WITH_OPENAL ON)
       SET(OPENAL_LIB ${OPENAL_LIBRARY})
@@ -362,12 +353,12 @@
   SET(GETTEXT_LIB intl iconv)
   SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
 
-  SET(PNG_LIB png)
-  SET(JPEG_LIB jpeg)
+  SET(PNG_LIBRARIES png)
+  SET(JPEG_LIBRARY jpeg)
 
   SET(ZLIB /usr)
   SET(ZLIB_INC "${ZLIB}/include")
-  SET(ZLIB_LIB z)
+  SET(ZLIB_LIBRARIES z)
 
   SET(FREETYPE ${LIBDIR}/freetype)
   SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
@@ -438,7 +429,7 @@
 
 #-----------------------------------------------------------------------------
 # Configure OpenGL.
-INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
+FIND_PACKAGE(OpenGL)
 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
 #-----------------------------------------------------------------------------
 # Extra compile flags





More information about the Bf-blender-cvs mailing list