[CMake] Installing SWIG output (UseSWIG.cmake)

Matt Williams lists at milliams.com
Fri Mar 27 17:51:22 EDT 2009


Hi all,

I've just started using SWIG to create binding for my library. So far
I've only bound one file, called Enums.h, with a SWIG interface
Enums.i.
At present my CMakeLists.txt file looks like:

include(${SWIG_USE_FILE})

find_package(PythonLibs)
include_directories(${PYTHON_INCLUDE_PATH})

set(CMAKE_SWIG_FLAGS "")
set_source_files_properties(Enums.i PROPERTIES CPLUSPLUS ON)

swig_add_module(Enums python Enums.i)
swig_link_libraries(Enums ${PYTHON_LIBRARIES})


Which creates the files:
    ${CMAKE_CURRENT_BINARY_DIR}/Enums.py
    ${CMAKE_CURRENT_BINARY_DIR}/Release/_Enums.lib
    ${CMAKE_CURRENT_BINARY_DIR}/Release/_Enums.dll
    plus some temporary .idb and .exp files

My question is how would I go about installing these files in a neat,
non-hacky way? I guess the .py and .lib files need to go into a lib/
folder and the .dll needs to go into bin/. I tried something like:

INSTALL(TARGETS _Enums
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib
)

but that simply installed _Enums.dll into the lib folder.


I'm using Visual Stusio 2008 here but I'm also going to try to get
this working on Linux too.

Regards,
Matt


More information about the CMake mailing list