[CMake] Result of FIND_LIBRARY changing its value
Eduard Bloch
edi at gmx.de
Sun Nov 26 11:08:54 EST 2006
Hello,
I have a problem with the FIND_LIBRARY directive. I need to look in
/usr/local/lib for libraries that may be installed additionaly by user.
But then I would like to use the libs found there and not the ones in
default system path. Therefore, I would like to have the full path to
the library or having -L/usr/local/lib attached only before the extra
libraries are specified. I tried to use the value returned by
FIND_LIBRARY. I can print it with MESSAGE() and I see
/usr/local/lib/libiconv.a there (it's an AIX system, don't wonder). It
seems also to work with lib lists passed with LINK_LIBRARIES.
However, when this var is passed to TARGET_LINK_LIBRARIES, it seems to
be changed to "-liconv" in the call. It is visible with VERBOSE=1, there
is suddenly -liconv instead of /usr/local/lib/libiconv.a .
What can I do to solve that? Adding -L/usr/local/lib to the compiler
flags is a workaround, but is there any better way?
Eduard.
PROJECT (MKISOFS)
INCLUDE(../include/AddScgBits.cmake)
INCLUDE(../include/AddSchilyBits.cmake)
INCLUDE_DIRECTORIES(../include ../libhfs_iso ../wodim ${CMAKE_BINARY_DIR})
FIND_FILE (USE_MAGIC magic.h)
IF(USE_MAGIC)
ADD_DEFINITIONS(-DUSE_MAGIC)
SET(MAGICLIBS magic)
ENDIF(USE_MAGIC)
# iconv may be provided by an additional library ; cludge, should test with a compile/link test
IF(HAVE_ICONV_H)
MESSAGE("Using iconv, extra lib available?")
FIND_LIBRARY (USE_LIBICONV iconv PATHS /usr/local/lib )
MESSAGE("Using iconv, extra lib available?${USE_LIBICONV}")
IF(USE_LIBICONV)
# better use the direct path to avoid confusion with multiple libs
MESSAGE(" SET(EXTRA_LIBICONV ${USE_LIBICONV}")
SET(EXTRA_LIBICONV "${USE_LIBICONV}")
ENDIF(USE_LIBICONV)
ENDIF(HAVE_ICONV_H)
ADD_DEFINITIONS(-DUSE_LARGEFILES -DABORT_DEEP_ISO_ONLY -DAPPLE_HYB -DUDF -DDVD_VIDEO -DSORTING -DHAVE_CONFIG_H -DUSE_LIBSCHILY -DUSE_SCG -DJIGDO_TEMPLATE)
SET(MKISOFS_MOST_SRCS apple.c boot.c cd_misc.c defaults.c desktop.c dvd_file.c dvd_reader.c eltorito.c exclude.c files.c fnmatch.c getnum.c getopt.c getopt1.c hash.c ifo_read.c ->joliet.c mac_label.c match.c modes.c multi.c name.c rock.c scsi.c scsi_cdr.c stream.c tree.c udf.c vms.c volume.c write.c boot-alpha.c boot-hppa.c boot-mips.c md5.c jte.c rsync.c
boot-mipsel.c endian.c )
#SET_SOURCE_FILES_PROPERTIES(${MKISOFS_MOST_SRCS} PROPERTIES )
LINK_DIRECTORIES(../libhfs_iso ../librols ../libusal ../libunls ../libdeflt)
ADD_EXECUTABLE (genisoimage genisoimage.c ${MKISOFS_MOST_SRCS})
TARGET_LINK_LIBRARIES(genisoimage hfs_iso deflt ${MAGICLIBS} c unls z ${EXTRA_LIBICONV} ${EXTRA_LIBS})
# common lib set and genisoimage source parts for the rest
LINK_LIBRARIES(${EXTRA_LIBS} deflt unls ${EXTRA_LIBICONV} )
SET(MI_COMMON scsi.c scsi_cdr.c cd_misc.c modes.c defaults.c getnum.c)
ADD_EXECUTABLE(devdump diag/dump.c ${MI_COMMON})
ADD_EXECUTABLE(isodebug diag/isodebug.c ${MI_COMMON})
ADD_EXECUTABLE(isodump diag/isodump.c ${MI_COMMON})
ADD_EXECUTABLE(isoinfo diag/isoinfo.c ${MI_COMMON})
ADD_EXECUTABLE(isovfy diag/isovfy.c ${MI_COMMON})
SET_TARGET_PROPERTIES(genisoimage devdump isodebug isodump isoinfo isovfy PROPERTIES SKIP_BUILD_RPATH TRUE)
INSTALL(TARGETS genisoimage devdump isodebug isodump isoinfo isovfy DESTINATION bin)
INSTALL(FILES
genisoimage.8
diag/devdump.8
diag/isodebug.8
diag/isodump.8
diag/isoinfo.8
diag/isovfy.8
DESTINATION share/man/man8)
* Bill Hoffman [Tue, Nov 21 2006, 10:57:35AM]:
> On behalf of myself, Ken, Brad, Andy and the rest of the CMake team, we are
> pleased to announce that CMake 2.4.4 is available for download at:
> http://www.cmake.org/HTML/Download.html
> If you have any problems or find any bugs, please report them at
> www.cmake.org/Bug.
> A list of changes for the 2.4 release tree is included below.
>
> Thanks Bill
>
> Changes in CMake 2.4.4
>
> * CMake Version numbers on module directory
>
> * elseif added
>
> * Fix docs in CheckCSourceCompiles CheckCXXSourceCompiles and diagnostic
> output.
>
> * added Check(C/CXX)SourceRuns.cmake, CheckCXXCompilerFlag.cmake, Check
>
> * add static and shared flags to make sure the specified versions of
> libraries are used with -static -lfoo -shared -lbar
>
> * Search for the compiler only once and store a full path. avoids problems
> with PATH changes in cmake re-runs.
>
> * make sure manifest files are generated with VS 8
>
> * added FindASPELL.cmake, FindBZip2.cmake FindHPELL.cmake, FindJasper.cmake
> FindLibXml2.cmake, FindLibXslt.cmake, FindOpenSSL.cmake
>
> * fix for bug#3646 GLUT not Glut for framework name
>
> * many fixes for FindKDE3.cmake
>
> * Better FindPNG that honors REQUIRED and looks in more places.
>
> * Support to find python 2.5
>
> * Find Qt3 better
>
> * Find Qt4 better and work with qmake and qmake-qt4 on the same machine.
>
> * Much better FindRuby.cmake
>
> * More stuff marked as advanced in FindTcl and FindSDL
>
> * FindwxWidgets runs shell script wx-config with sh
>
> * Support for cpack and vs8 install libraries
>
> * Darwin shared library create and Fortran now work
>
> * Support for isystem directories INCLUDE_DIRECTORIES (SYSTEM)
>
> * Targets in makefiles to create pre-processed files and assembly files
> can be turned off with these variables:
> CMAKE_SKIP_PREPROCESSED_SOURCE_RULES CMAKE_SKIP_ASSEMBLY_SOURCE_RULES
>
> * Support for QNX
>
> * Better default search paths for unix and FIND_* stuff
>
> * Use link /lib and not lib to create static libraries with MS
>
> * Useqt4 works with static qt4 and other fixes
>
> * UseSwig.cmake interface to add extra dependencies.
>
> * Added APPEND option to ADD_CUSTOM_COMMAND, Added VERBATIM option to
> ADD_CUSTOM_COMMAND and ADD_CUSTOM_TARGET
>
> * add NOT_IN_ALL option for ADD_LIBRARY and ADD_EXECUTABLE
>
> * Fix automatic computation of binary path to work for subdirectories of out
> of source directories. This addresses bug#3592.
>
> * --debug-ouput to cmake that gives stack trace to message send error
> commands.
> The stack trace is no longer there without it.
>
> * + can be in a variable
>
> * Do not replace @VAR@ syntax in list files. This addresses bug #2722
>
> * much faster depend scanning
>
> * do depends on system include directories
>
> * Permission and install directory fixes
>
> * New target property <CONFIG>_LOCATION (Debug, Release, etc)
>
> * fix exclude from all in VS
>
> * fix code completion problem in KDevelop
>
> * Define MSYS when using msys generator
>
> * fix reference's to projects outside the build tree VS 7,8
>
> * Fix ZERO_CHECK to not always try and rebuild
>
> * Fix Xcode universal binary rebuild problem
>
> * add FILE_IS_NEWER to if command
>
> * Add OPTIONAL to INSTALL command fix bug at 2922
>
> * add SORT and REVERSE to LIST command
>
> * fix for seg fault bug #3815
>
> * add SYBOLIC as a source file property see SET_SOURCE_FILES_PROPERTIES
>
> * fix ctest valgrind if no coverage is done
>
> * better message if bogus generator is specified.
>
> * Better FindJava and FindJNI
>
> * Fix doxygen.config for CMake
>
> * add CPACK_MODULE_PATH
>
> * Fix configuration for ctest dashboard targets Experimental, Nightly, etc
>
> * Fix FindDoxygen for mac and app-bundles
>
> * Fix CPack simple install test with NSIS
>
> * Allow EXECUTE_PROCESS to strip trailing white space
>
> * Fix mingw echo in makefiles
>
> * Fix Xcode to not mess up -gdwarf-2
>
> * Fix crash when "linking" to custom targets.
>
> * Allow HEADER_FILE_ONLY to not compile the file in VS 7 and 8
>
> * Fix mingw out of binary with spaces in the path.
>
> * Fix for sudo make install (partial)
>
> * Allow installed zlib, curl, expat, xmlrpc to be used.
>
> * Add CMakeDependentOption.cmake module
>
> * Allow projects to set install prefix default
>
> * improved Find/Use wxWidgets
>
> * add support for windows dll version numbers
>
> * Fix message for -G when generator does not exist
>
> * Fix html references in help
>
> * Fix version on .exe cygwin
>
> * allow global timeout in ctest
>
> * Fix some odd cases with custom commands in VS 6
>
> * Fix path suffix stuff with lib64 in FIND_* stuff.
>
> * Fix delete in CMakeSetup to not change the current position in the list
>
> * Fix debug stl run of ctest on Mac
>
> * Use #2 for manifest nt command on dll and #1 on exe
>
> * Add depends from files inside qrc files in qt
>
> * Fix explort_library_depends to work with optimized and debug
>
> Changes in CMake 2.4.3
>
> * fix for 3557 - Under MSVC8 hardcoded TargetEnvironment for MIDL Compiler
>
> * Fix for Xcode all projects to prevent -fvisibility=hidden flags. This is
> needed to make RTTI work by default.
>
> * better prototype for main in try compile of c programs avoids warnings in
> logs.
>
> * with visual studio do not use incremental linking for release builds by
> default.
>
> * fix bootstrap to use more ansi c main it test compiler
>
> * fix import build settings to do case insensitive match on windows
>
> * fix building in root directory c:/
>
> * Add support for CXX only projects
>
> * Better FindWxWidgets
>
> * Added FindBoose.cmake
>
> * add more fortran file extensions
>
> * Cpack supports multiple packages at the same time
>
> * Fix to FindKDE4 to look for kde4-config first
>
> * Support for env var CMAKE_CONFIG_TYPE in ctest
>
> * Fix for -DVAR=foo on the command line not saving to the cache
>
> * ENH: Added creation of XXX_FIND_COMPONENTS list of all components
> requested
> withREQUIRED option. This addresses the feature request in bug#3494.
>
> * Object files get safe names
>
> * progress is now reported with makefiles
>
> * location of CMakeTmp changed to a varible
>
> * CMAKE_COLOR_MAKEFILE cache variable available to turn off color output
>
> * fixes for FindQt4 on mac.
>
> * Better search paths for finding VTK
>
> * Fix relative path problems in ADD_SUBDIRECTORY
>
> * Fix long link commands on UNIX shells
>
> * Fix depend file names in makefiles for generated headers
>
> * CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS allows for if/endif without variable
>
> * Xcode multiple custom command problem fixed.
>
> * INSTALL_RPATH_USE_LINK_PATH when true will add the link path to the rpath
>
> * Add target/fast rules in the sub directories
>
> * Fix Visual stuido C and C++ targets to not add /TP and /TC
>
> * print a context when cmake errors occur
>
> * add rxvt-unicode, cygwin, and screen terminal support for color output
>
> * Fix crash in CMakeSetup when status line is long
>
> * make sure try compile files have a newline at the end
>
> * fix for hp itanium build
>
> Changes in CMake 2.4.2
>
> * Run symlink command from correct directory for executable versions
>
> * Fix for universal binaries and Xcode depend problem
>
> * Changes to LIST command, see --help-command LIST
>
> * Fix FindQT to be able to use full paths to source files
>
> * Fix CPack ZIP on windows command line problem
>
> * Find executables with no extension on windows mingw
>
> * Fix FindQt3 to use QTDIR over path
>
> * Significant speedup in try-compile for nmake
>
> * CPack improvments including tar bzip2
>
> * FindQt4 windows path fix
>
> * Sunos cc optimize flags are correct
>
> * Fix crash with ${} empty variable
>
> * Increase depend speed on Mac OS.
>
> * install command CONFIGURATIONS option.
>
> * Fix MSVC60, MSVC70, MSVC71, MSVC80 definitions for IDE builds
>
> * Fix for C++ compiler being used for c code in VS IDE
>
> Changes in CMake 2.4.1
>
> * Several ctest and cpack bug fixes
>
> * Many updates and fixes for FindQt4.cmake
>
> * Fix CMAKE_REQUIRED_FLAGS in CheckCXXSourceCompiles.cmake
>
> * Handle running make from a symlinked build tree
>
> * Automatic color ouput detection for shells building with make
>
> * Kdevelop generator handles CMakeFiles directory better
>
> * add correct depend information for fluid
>
> * allow the cache to be saved even if a fatal error occurs
>
> * fix bug in relative path subdir and add_subdirectoy commands
>
> * support in vs for two object files with the same name
>
> * short file names used for library paths in visual studio
>
> * package target only shows up when you have cpack config files
>
> * Use dl and not -ldl for adding in the dynamic library
>
> * Fix check c/cxx source compiles macros to not clobber log files
>
> * Fix nmake version detection of cl and create correct pdb files
>
> * Fix msys bootstrap
>
> * Change color output to be more readable
>
> * Fix vs6 library naming
>
> Changes in CMake 2.4.0
>
> * CPack beta
>
> * Visual Studio 2005 win64 support
>
> * Improved install support
>
> * Improved FIND_PROGRAM, FIND_LIBRARY, FIND_PATH, FIND_FILE
>
> * Improved support for finding/using OSX Frameworks
>
> * Multiple output support for custom commands
>
> * Color output in make with vt100 terminals CMAKE_COLOR_MAKFILE
>
> * Better variables for MSVC MSVC80
>
> * Library path order is preserved
>
> * Fix for text file busy in xcodebuild runs
>
> * Better bundle support on OSX
>
> * ctest -S scripts can run in new process with new environment
>
> * OSX universal binary support
>
> * Watcom support
>
> * MinGW and MSYS support
>
> * Visual studio 2005 manifest support
>
> * Better handling of RPATH, no longer put rpath in install tree
>
> * Fix OUTPUT_NAME
>
> * ctest captures output from vcexpress
>
> * cmake --help-module can give help for cmake modules
>
> * Lots of bug fixes
>
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
--
<Salz> jjFux: Ted hieß ja früher auch Walther
<Salz> winkiller: hm... es sind 8... die 7 kandidaten und NOTA
<Madkiss> Ist der jetzt eigentlich eine gespaltene Persönlichkeit, bei der aber
beide Teile bekloppt sind?
More information about the CMake
mailing list