[CMake] Compiling dll under MSVC 2008

Benoit benpaka.spam at gmail.com
Thu Apr 16 13:39:26 EDT 2009


Hello,

I've a problem when using libraries under MS Visual C++ 2008 Express Edition
but it works fine with GCC and MinGW.

I have first create a core (cv7core) library that compile correctly (I
obtain cv7core.dll), however I doesn't create the static lib.
Then I create another library that use the first one but it doesn't compile
because it doesn't find the cv7core.lib:

LINK : fatal error LNK1104: no se puede abrir el archivo
'..\cv7core\Debug\cv7core.lib'

My CmakeLists.txt have the following interesant part:


------------------------------------------------------------------------------
*./CmakeLists.txt:*
------------------------------------------------------------------------------
...
## On DLL platform put also *.dll
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
 ${PROJECT_INSTALL_PATH}/bin
 CACHE PATH
 "Single Directory for all Executables and DLL."
)

## Otherwise put library in lib folder.
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
 ${PROJECT_INSTALL_PATH}/lib
 CACHE PATH
  "Single Directory for all Libraries"
)
...


------------------------------------------------------------------------------
*./src/cv7core/CmakeLists.txt:*
------------------------------------------------------------------------------
set(LIBNAME "cv7core")
set(SRC_FILES  cv7BGModel.c cv7ConCompo.c ...)
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/include/${LIBNAME})

# change lib_target properties
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES
VERSION ${${PROJECT_NAME}_MINOR_VERSION}
SOVERSION ${${PROJECT_NAME}_MINOR_VERSION}
#CLEAN_DIRECT_OUTPUT 1 # avoid conflicts between library and binary target
names
#OUTPUT_NAME ${LIBNAME} # allow creating static and shared libs without
conflicts
)


It is maybe a very stupid things but i'm not microsoft friendly and it is
the first time i use the MSVC compilator

--
Benoit RAT
www.neub.co.nr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090416/28d79762/attachment.htm>


More information about the CMake mailing list