Hi everyone,

While packaging CMake 2.8.12 on FreeBSD, I noticed that BRL-CAD was
failing to build right at the configuration stage:

  [...]
  -- Found PNG: /usr/local/lib/libpng.so (found version "1.5.17")
  [...]
  CMake Error: The following variables are used in this project, but they are 
set to NOTFOUND.
  Please set them or make sure they are set and tested correctly in the CMake 
files:
  PNG
    linked by target "libicv" in directory 
/wrkdirs/usr/ports/cad/brlcad/work/brlcad-7.24.0/src/libicv
    linked by target "libicv-static" in directory 
/wrkdirs/usr/ports/cad/brlcad/work/brlcad-7.24.0/src/libicv
    linked by target "fb-png" in directory 
/wrkdirs/usr/ports/cad/brlcad/work/brlcad-7.24.0/src/fb
    linked by target "png-fb" in directory 
/wrkdirs/usr/ports/cad/brlcad/work/brlcad-7.24.0/src/fb
    linked by target "bw-png" in directory 
/wrkdirs/usr/ports/cad/brlcad/work/brlcad-7.24.0/src/util
    linked by target "pix-png" in directory 
/wrkdirs/usr/ports/cad/brlcad/work/brlcad-7.24.0/src/util
    linked by target "png-bw" in directory 
/wrkdirs/usr/ports/cad/brlcad/work/brlcad-7.24.0/src/util
    linked by target "png-pix" in directory 
/wrkdirs/usr/ports/cad/brlcad/work/brlcad-7.24.0/src/util
    linked by target "png_info" in directory 
/wrkdirs/usr/ports/cad/brlcad/work/brlcad-7.24.0/src/util
  -- Configuring incomplete, errors occurred!

This is caused by [1] in CMake, which changed the FIND_LIBRARY() calls
done in FindPNG.cmake and made the module use
SELECT_LIBRARY_CONFIGURATIONS() to set the right value for PNG_LIBRARY.

[1] 
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2a7975398f4e7fb02887539c19bea5f390f1156f

The commit itself is correct, but it made more visible a problem that
already existed in BRL-CAD: src/other/CMakeLists.txt and its parent
CMakeLists.txt files assume simple SET() calls propagate up in scope,
while this is not true. Before that commit in CMake, PNG_LIBRARY would
be visible to all CMakeLists.txt files because it was set in the cache
by FIND_LIBRARY(), while SELECT_LIBRARY_CONFIGURATIONS() just calls
SET().

The patch below is a dirty, stop-gap measure to keep things working. I'm
not a BRL-CAD developer, so my idea here is to bring the issue up to the
community as I couldn't find any discussions or commits in trunk about
this.

Thanks!

Index: src/other/CMakeLists.txt
===================================================================
--- src/other/CMakeLists.txt    (revision 58410)
+++ src/other/CMakeLists.txt    (working copy)
@@ -349,6 +349,7 @@
   # PNG_INCLUDE_DIR, so a generic macro won't pick up the setting -
   # handle it here.
 
+  set(PNG_LIBRARY "${PNG_LIBRARY}" CACHE STRING "PNG library" FORCE)
   set(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} CACHE STRING "PNG include 
directory" FORCE)
 endif(BRLCAD_PNG_BUILD)
 DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/libpng/CTestTestfile.cmake)


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to