[CMake] Lnk 1104 with nmake, and the lib prefix
Alain Leblanc
aalebl at gmail.com
Fri Sep 18 18:51:12 EDT 2009
Hi,
I'm having a problem building a dll using CMake with the nmake
generator. It may be more of a VC++ question, but I figured someone
here might know the answer.
I have some C++ file that make calls to the boost libraries. I want to
put them in a dll. CMake finds the libraries ok. This is from the
generated build.cmake file.
--------------------------------------------------
# External object files for target utility
utility_EXTERNAL_OBJECTS =
utility.dll: CMakeFiles\utility.dir\Attribute.cc.obj
utility.dll: CMakeFiles\utility.dir\AttributeSet.cc.obj
utility.dll: CMakeFiles\utility.dir\FileUtility.cc.obj
utility.dll: CMakeFiles\utility.dir\MatrixUtil.cc.obj
utility.dll: CMakeFiles\utility.dir\StringUtility.cc.obj
utility.dll: CMakeFiles\utility.dir\ThreadInterface.cc.obj
utility.dll: CMakeFiles\utility.dir\XDEMessage.cc.obj
utility.dll: E:\projects\trunk\mathstat\src\mslib\mathstat.lib
utility.dll: "C:\Program
Files\boost\boost_1_39\lib\boost_regex-vc90-mt-gd-1_39.lib"
utility.dll: "C:\Program
Files\boost\boost_1_39\lib\boost_system-vc90-mt-gd-1_39.lib"
utility.dll: "C:\Program
Files\boost\boost_1_39\lib\boost_filesystem-vc90-mt-gd-1_39.lib"
utility.dll: "C:\Program
Files\boost\boost_1_39\lib\boost_date_time-vc90-mt-gd-1_39.lib"
utility.dll: "C:\Program
Files\boost\boost_1_39\lib\boost_system-vc90-mt-gd-1_39.lib"
utility.dll: "C:\Program
Files\xerces-c-3.0.1-x86-windows-vc-9.0\lib\xerces-c_3.lib"
utility.dll: "C:\Program
Files\boost\boost_1_39\lib\boost_filesystem-vc90-mt-gd-1_39.lib"
utility.dll: "C:\Program
Files\boost\boost_1_39\lib\boost_date_time-vc90-mt-gd-1_39.lib"
utility.dll: "C:\Program
Files\xerces-c-3.0.1-x86-windows-vc-9.0\lib\xerces-c_3.lib"
utility.dll: CMakeFiles\utility.dir\build.make
utility.dll: CMakeFiles\utility.dir\objects1.rsp
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold
"Linking CXX shared library utility.dll"
...
--------------------------------------------------------------------------------------
When I run nmake all the source files are compiled OK, but then I get
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Done with cmake.
-- Configuring done
-- Generating done
-- Build files have been written to: E:/projects/trunk/XDE/src/utility
Linking CXX shared library utility.dll
LINK : warning LNK4044: unrecognized option '/DWINDOWS'; ignored
LINK : fatal error LNK1104: cannot open file
'libboost_filesystem-vc90-mt-gd-1_39.lib'
LINK Pass 1 failed. with 1104
NMAKE : fatal error U1077: '"C:\Program Files\CMake 2.6\bin\cmake.exe"' : return
code '0xffffffff'
Stop.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Notice than nmake complains about not finding libboost_filesystemXXX,
while the build.cmake refers to boost_filesystemXXX, which are the
actual names of the boost libraries on my system. My CMake
instructions are (cut and paste from different files)
# Change the following to look for a particular version of boost
# With the current options nmake will look for the mt-gd-1_39, even though
# the mt-1_39 is there. Probably due to compiler options.
set (BOOST_SUFFIX "-vc90-mt-gd-1_39")
find_library(BOOST_REGEX NAMES boost_regex-mt
boost_regex${BOOST_SUFFIX} PATHS ${LIBRARIES_SEARCH_PATH})
find_library(BOOST_FILESYSTEM NAMES boost_filesystem-mt
boost_filesystem${BOOST_SUFFIX} PATHS ${LIBRARIES_SEARCH_PATH})
find_library(BOOST_SYSTEM NAMES boost_system-mt
boost_system${BOOST_SUFFIX} PATHS ${LIBRARIES_SEARCH_PATH})
find_library(BOOST_DATETIME NAMES boost_date_time-mt
boost_date_time${BOOST_SUFFIX} PATHS ${LIBRARIES_SEARCH_PATH})
find_library(BOOST_SYSTEM NAMES boost_system-mt
boost_system${BOOST_SUFFIX} PATHS ${LIBRARIES_SEARCH_PATH})
...
add_library(utility SHARED ${SRC_FILES})
target_link_libraries(utility ${MATHSTAT} ${BOOST_LIBRARIES})
where ${BOOST_LIBRARIES} is a list of all the BOOST_REGEX, etc
Am I missing something obvious here?
Thanks,
Alain
More information about the CMake
mailing list