summaryrefslogtreecommitdiffstats
path: root/Modules/UseSWIG.cmake
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2007-03-05 20:21:49 (GMT)
committerKen Martin <ken.martin@kitware.com>2007-03-05 20:21:49 (GMT)
commit8b7ff9b08b5371c718a7283a99f0bf9306026142 (patch)
tree58912862e9e9dd1245c855164ae9bb9c16120d63 /Modules/UseSWIG.cmake
parent73a5c33f9b472700c10524262e8ab4cab6af2fe0 (diff)
downloadCMake-8b7ff9b08b5371c718a7283a99f0bf9306026142.zip
CMake-8b7ff9b08b5371c718a7283a99f0bf9306026142.tar.gz
CMake-8b7ff9b08b5371c718a7283a99f0bf9306026142.tar.bz2
ENH: patch applied for bug 4517
Diffstat (limited to 'Modules/UseSWIG.cmake')
-rw-r--r--Modules/UseSWIG.cmake63
1 files changed, 25 insertions, 38 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index fee83a5..19feb87 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -49,7 +49,7 @@ ENDMACRO(SWIG_MODULE_INITIALIZE)
MACRO(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
FOREACH(it ${SWIG_PYTHON_EXTRA_FILE_EXTENSION})
- SET(outfiles ${outfiles}
+ SET(${outfiles} ${${outfiles}}
"${generatedpath}/${infile}.${it}")
ENDFOREACH(it)
ENDMACRO(SWIG_GET_EXTRA_OUTPUT_FILES)
@@ -96,9 +96,15 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
SET(swig_generated_file_fullname
"${swig_generated_file_fullname}/${swig_source_file_relative_path}")
ENDIF(swig_source_file_relative_path)
+ # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
+ IF(CMAKE_SWIG_OUTDIR)
+ SET(swig_outdir ${CMAKE_SWIG_OUTDIR})
+ ELSE(CMAKE_SWIG_OUTDIR)
+ SET(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
+ ENDIF(CMAKE_SWIG_OUTDIR)
SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
swig_extra_generated_files
- "${swig_generated_file_fullname}"
+ "${swig_outdir}"
"${swig_source_file_name_we}")
SET(swig_generated_file_fullname
"${swig_generated_file_fullname}/${swig_source_file_name_we}")
@@ -132,43 +138,24 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
IF(SWIG_MODULE_${name}_EXTRA_FLAGS)
SET(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS})
ENDIF(SWIG_MODULE_${name}_EXTRA_FLAGS)
- # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
- IF(CMAKE_SWIG_OUTDIR)
- ADD_CUSTOM_COMMAND(
- OUTPUT "${swig_generated_file_fullname}"
- COMMAND "${SWIG_EXECUTABLE}"
- ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
- ${swig_source_file_flags}
- ${CMAKE_SWIG_FLAGS}
- -outdir ${CMAKE_SWIG_OUTDIR}
- ${swig_special_flags}
- ${swig_extra_flags}
- ${swig_include_dirs}
- -o "${swig_generated_file_fullname}"
- "${swig_source_file_fullname}"
- MAIN_DEPENDENCY "${swig_source_file_fullname}"
- DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
- COMMENT "Swig source")
- ELSE(CMAKE_SWIG_OUTDIR)
- ADD_CUSTOM_COMMAND(
- OUTPUT "${swig_generated_file_fullname}"
- COMMAND "${SWIG_EXECUTABLE}"
- ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
- ${swig_source_file_flags}
- ${CMAKE_SWIG_FLAGS}
- ${swig_outdir_flags}
- ${swig_special_flags}
- ${swig_extra_flags}
- ${swig_include_dirs}
- -o "${swig_generated_file_fullname}"
- "${swig_source_file_fullname}"
- MAIN_DEPENDENCY "${swig_source_file_fullname}"
- DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
- COMMENT "Swig source")
- ENDIF(CMAKE_SWIG_OUTDIR)
- SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}"
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files}
+ COMMAND "${SWIG_EXECUTABLE}"
+ ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
+ ${swig_source_file_flags}
+ ${CMAKE_SWIG_FLAGS}
+ -outdir ${swig_outdir}
+ ${swig_special_flags}
+ ${swig_extra_flags}
+ ${swig_include_dirs}
+ -o "${swig_generated_file_fullname}"
+ "${swig_source_file_fullname}"
+ MAIN_DEPENDENCY "${swig_source_file_fullname}"
+ DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
+ COMMENT "Swig source")
+ SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}" ${swig_extra_generated_files}
PROPERTIES GENERATED 1)
- SET(${outfiles} "${swig_generated_file_fullname}")
+ SET(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files})
ENDMACRO(SWIG_ADD_SOURCE_TO_MODULE)
#