[CMake] Problem finding installed library on Windows platform

Stephen Torri stephen.torri at gmail.com
Mon Jun 20 08:49:00 EDT 2011


Subject: Finding libraries on Windows platform

--------

I am using CMake 2.8 on Windows XP to create a Visual Studio 2010 solution.
The problem I am having is that I cannot get CMake to find libraries on the
system. These libraries were created by us for other project. Here is the
CMake module for finding one of those libraries:

IF(UNIX)
 FIND_PATH ( TARGET_INCLUDE_DIR interface.hpp /usr/include/target
/usr/local/include/target)
 FIND_LIBRARY ( TARGET_LIBRARY NAMES target PATH /usr/lib /usr/local/lib)
ELSE(UNIX)
 FIND_PATH ( TARGET_INCLUDE_DIR interface.hpp
    $ENV{TARGET_INCLUDE_DIR}
   "C:/Program Files/target/include"
 "C:/Program Files (x86)/target/include"
 "C:/Program Files (x86)/target 1.0.0/include"
 DOC "If you installed Target where did you install it?" )

 FIND_LIBRARY ( TARGET_LIBRARY NAMES sgp4 PATH
   $ENV{TARGET_LIBRARY}
   "C:/Program Files/target"
   "C:/Program Files (x86)/target"
   "C:/Program Files (x86)/target 1.0.0" )
ENDIF(UNIX)

IF (TARGET_INCLUDE_DIR AND TARGET_LIBRARY)
 SET(TARGET_FOUND TRUE)
ENDIF(TARGET_INCLUDE_DIR AND TARGET_LIBRARY)

IF (TARGET_FOUND)
 IF (NOT target_FIND_QUIETLY)
   MESSAGE(STATUS "Found Target: ${TARGET_LIBRARY}")
 ENDIF (NOT target_FIND_QUIETLY)
ELSE (TARGET_FOUND)
 IF (target_FIND_REQUIRED)
   MESSAGE(FATAL_ERROR "Could not find Target")
 ENDIF (target_FIND_REQUIRED)
ENDIF (TARGET_FOUND)

The macro is finding the include header fine but is always failing to find
the library.
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110620/9c583d05/attachment.htm>


More information about the CMake mailing list