[CMake] libraries

jecxz at telus.net jecxz at telus.net
Tue Aug 8 13:18:37 EDT 2006


I'm a newbie to cmake and am running CMake 2.4.2 on WinXP, using the  
command line tools from MS's 2005 toolkit.

my directories look like
c:\pkg\c\cmake\my\s	- lib sources
                         |    \o 	- build dir. for my.lib - static
                        wh-\o    - app build - my build directory
                              \s    - app sources

All seems to work as expected, except I cannot get cmake to find the  
library directly.

If I add the path to it to the environment variable LIB, the link step  
completes properly.

Any hints or help would be most appreciated.

TIA


My cmakelists.txt file in wh\s
-----------------------
Project( which )
ADD_EXECUTABLE( which which )

INCLUDE_DIRECTORIES( ${WHICH_SOURCE_DIR} c:\\my\\h )

SET (CMAKE_VERBOSE_MAKEFILE ON)

OPTION( WHICH_DEBUG
    "Build for debugging"
    ON )

#LINK_DIRECTORIES( ${WHICH_BINARY_DIR}/../../my/o )
#LINK_DIRECTORIES( c:\\pkg\\c\\cmake\\my\\o )
#LINK_DIRECTORIES( c:/pkg/c/cmake/my/o )
FIND_LIBRARY( MY_LIB NAMES my MY PATHS c:\\pkg\\c\\cmake\\my\\o  
c:/pkg/c/cmake/my/o )
# None of the above let nmake find the necessary lib

#link in the support libray
TARGET_LINK_LIBRARIES( which my )

-----------------

The output from running nmake:
==============
C:\pkg\c\cmake\wh\o>cmakesetup

C:\pkg\c\cmake\wh\o>"c:\program files\cmake 2.4\bin\cmakesetup.exe"

C:\pkg\c\cmake\wh\o>cmake ../s
-- Configuring done
-- Generating done
-- Build files have been written to: C:/pkg/c/cmake/wh/o

C:\pkg\c\cmake\wh\o>nmake

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

         "C:\Program Files\CMake 2.4\bin\cmake.exe" -HC:\pkg\c\cmake\wh\s  
-BC:\pk
g\c\cmake\wh\o --check-build-system CMakeFiles\Makefile.cmake 0
         "C:\Program Files\Microsoft Visual Studio 8\VC\BIN\nmake.exe" -f  
CMakeFi
les/Makefile2 /nologo -                   all
         "C:\Program Files\Microsoft Visual Studio 8\VC\BIN\nmake.exe" -f  
CMakeFi
les\which.dir/build.make /nologo -L                   
CMakeFiles\which.dir\depend

         "C:\Program Files\Microsoft Visual Studio 8\VC\BIN\nmake.exe" -f  
CMakeFi
les\which.dir/build.make /nologo -L                   
CMakeFiles\which.dir\build
Linking C executable which.exe
         "C:\Program Files\CMake 2.4\bin\cmake.exe" -P  
CMakeFiles\which.dir\cmake
_clean_target.cmake
         C:\PROGRA~1\MICROS~3\VC\bin\cl.exe  /nologo  
@C:\DOCUME~1\arnold\LOCALS~1
\Temp\nm2.tmp
LINK : fatal error LNK1104: cannot open file 'my.lib'
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3\VC\bin\cl.exe' : return  
code '0
x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio  
8\VC\BIN\n
make.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio  
8\VC\BIN\n
make.exe"' : return code '0x2'
Stop.

C:\pkg\c\cmake\wh\o>

==============
-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the CMake mailing list