[CMake] CMake adding libraries for Windows get such error ——LINK : fatal error LNK1104: can not open file “hello.lib”
xiaotian chen
mycmake at gmail.com
Sun Apr 1 04:51:39 EDT 2012
hi, the project wants to link the dll named hello.dll, and it has a import
library named hello.lib.
but when i do the Nmake command, it meet the fatal error,who can tell me
what's wrong with it.
thanks a lot!
my CMakeLists.txt in Project Dir:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(ANEWHELLO)
ADD_SUBDIRECTORY(src)
CMakeLists.txt in src Dir:
INCLUDE_DIRECTORIES(../../hellouselib/lib)
LINK_DIRECTORIES($ANEWHELLO/lib)
ADD_EXECUTABLE(anewhello main.cpp)
TARGET_LINK_LIBRARIES(anewhello hello)
here is the cmake output:
__________________________________________________________________________________
D:\Work\Projectcode\Cmake_example\anewhello\build>cmake -G "NMake
Makefiles" ..
CMake Warning (dev) at src/CMakeLists.txt:2 (LINK_DIRECTORIES):
This command specifies the relative path
../../hellouselib/build/lib
as a link directory.
Policy CMP0015 is not set: link_directories() treats paths relative to the
source dir. Run "cmake --help-policy CMP0015" for policy details. Use
the
cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to:
D:/Work/Projectcode/Cmake_example/anewhello
/build
D:\Work\Projectcode\Cmake_example\anewhello\build>cmake -G "NMake
Makefiles" ..
CMake Warning (dev) at src/CMakeLists.txt:2 (LINK_DIRECTORIES):
This command specifies the relative path
$ANEWHELLO/lib
as a link directory.
Policy CMP0015 is not set: link_directories() treats paths relative to the
source dir. Run "cmake --help-policy CMP0015" for policy details. Use
the
cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to:
D:/Work/Projectcode/Cmake_example/anewhello
/build
here is the Nmake output:
Linking CXX executable anewhello.exe
LINK : fatal error LNK1104: 无法打开文件“hello.lib”
LINK Pass 1 failed. with 2
NMAKE : fatal error U1077: “"C:\Program Files (x86)\CMake
2.8\bin\cmake.exe"”:
return code “0xffffffff”
Stop.
NMAKE : fatal error U1077: “"d:\Program Files (x86)\Microsoft Visual Studio
9.0
\VC\BIN\nmake.exe"”: return code “0x2”
Stop.
NMAKE : fatal error U1077: “"d:\Program Files (x86)\Microsoft Visual Studio
9.0
\VC\BIN\nmake.exe"”: return code “0x2”
Stop.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120401/94ea9797/attachment.htm>
More information about the CMake
mailing list