[CMake] Problem with target DLL name not matching SWIG dllimport name
Stephen Torri
stephen.torri at gmail.com
Wed Nov 16 11:41:02 EST 2011
I am using CMAKE_DEBUG_POSTFIX to attach a string to end of each DLL
name being built using Visual Studio 2008. The DLLs have the name that
expect which is the target name + CMAKE_DEBUG_POSTFIX. The problem I
am running into is the SWIG wrapper DLL name does not match the
dllimport flag when building a debug build.
For example the following is an example SWIG module named, example:
SWIG_ADD_MODULE(example python example.i example.cxx)
So with the CMAKE_DEBUG_POSTFIX the name is expected to be
example_d (Debug)
example (Release)
The problem comes in when I set the CMAKE_SWIG_FLAGS. Right now it
contains the "--dllimport example". When I use the built DLLs within
C# the SWIG code works for a release build because the dll name and
the expected name in the code match. Otherwise when I do a debug build
in C# the SWIG code is attempting to load "example.dll" when it has
"example_d.dll" in the directory.
I was wondering what is a work around for this?
My initial guess is that if I could get a handle on the "example_d"
part of the name with a CMAKE variable I could use that in the
CMAKE_SIWG_FLAGS for something like:
SET ( CMAKE_SWIG_FLAGS "--dllimport ${TARGET_NAME}" )
Stephen
More information about the CMake
mailing list