Discussion:
[CMake] Can I change the extension of a dll?
Georgios Petasis
2008-07-10 21:32:46 UTC
Permalink
Hi all,

I am trying to compile a python module with cmake. Unfortunately, in
python 2.5.2 they have decided that
C modules will use the extension .pyd, instead of .dll under windows.
So, I have to somehow rename
a dll during installation. I currenlty have code like:

INSTALL ( TARGETS ${PythonCDM_NAME_V}
RUNTIME DESTINATION
${PKG_HOME_DIR}/CDM/Python/${CMAKE_SYSTEM_NAME}/${PKG_OS_ARCH}
LIBRARY DESTINATION
${PKG_HOME_DIR}/CDM/Python/${CMAKE_SYSTEM_NAME}/${PKG_OS_ARCH} )

as I don't want .lib to be installed. Is there a way I can rename the
dll to have a .pyd extension?

George
Mike Jackson
2008-07-10 21:59:14 UTC
Permalink
This is what I use for my own expat library:

#----- Use MSVC Naming conventions for Shared Libraries
IF (MINGW AND BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES( expat
PROPERTIES
IMPORT_SUFFIX ".lib"
IMPORT_PREFIX ""
PREFIX ""
)
ENDIF (MINGW AND BUILD_SHARED_LIBS)

So, under MinGW, dynamic libraries would be expat.lib

For your case you would want something like:
IF ( BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES( ${PythonCDM_NAME
PROPERTIES
IMPORT_SUFFIX ".pyd"
IMPORT_PREFIX ""
PREFIX ""
)
ENDIF (BUILD_SHARED_LIBS)

I _think_ that is what you want. I am still "new" to windows dll
stuff so I may be off base a bit but you get the idea where to look.
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology Services
Post by Georgios Petasis
Hi all,
I am trying to compile a python module with cmake. Unfortunately,
in python 2.5.2 they have decided that
C modules will use the extension .pyd, instead of .dll under
windows. So, I have to somehow rename
INSTALL ( TARGETS ${PythonCDM_NAME_V}
RUNTIME DESTINATION
${PKG_HOME_DIR}/CDM/Python/${CMAKE_SYSTEM_NAME}/$
{PKG_OS_ARCH}
LIBRARY DESTINATION
${PKG_HOME_DIR}/CDM/Python/${CMAKE_SYSTEM_NAME}/$
{PKG_OS_ARCH} )
as I don't want .lib to be installed. Is there a way I can rename
the dll to have a .pyd extension?
George
_______________________________________________
CMake mailing list
http://www.cmake.org/mailman/listinfo/cmake
Loading...