UseSWIG: Fix .i relative source file location (#13173,#13772,#14459)

This commit is contained in:
Julien Schueller 2013-11-23 12:51:44 +01:00 committed by Brad King
parent 26ccafea46
commit 276e3735d8
1 changed files with 2 additions and 30 deletions

View File

@ -94,7 +94,6 @@ endmacro()
# #
macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
set(swig_full_infile ${infile}) set(swig_full_infile ${infile})
get_filename_component(swig_source_file_path "${infile}" PATH)
get_filename_component(swig_source_file_name_we "${infile}" NAME_WE) get_filename_component(swig_source_file_name_we "${infile}" NAME_WE)
get_source_file_property(swig_source_file_generated ${infile} GENERATED) get_source_file_property(swig_source_file_generated ${infile} GENERATED)
get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS) get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS)
@ -102,35 +101,8 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
if("${swig_source_file_flags}" STREQUAL "NOTFOUND") if("${swig_source_file_flags}" STREQUAL "NOTFOUND")
set(swig_source_file_flags "") set(swig_source_file_flags "")
endif() endif()
set(swig_source_file_fullname "${infile}") get_filename_component(swig_source_file_fullname "${infile}" ABSOLUTE)
if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}")
string(REGEX REPLACE
"^${CMAKE_CURRENT_SOURCE_DIR}" ""
swig_source_file_relative_path
"${swig_source_file_path}")
else()
if(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}")
string(REGEX REPLACE
"^${CMAKE_CURRENT_BINARY_DIR}" ""
swig_source_file_relative_path
"${swig_source_file_path}")
set(swig_source_file_generated 1)
else()
set(swig_source_file_relative_path "${swig_source_file_path}")
if(swig_source_file_generated)
set(swig_source_file_fullname "${CMAKE_CURRENT_BINARY_DIR}/${infile}")
else()
set(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}")
endif()
endif()
endif()
set(swig_generated_file_fullname
"${CMAKE_CURRENT_BINARY_DIR}")
if(swig_source_file_relative_path)
set(swig_generated_file_fullname
"${swig_generated_file_fullname}/${swig_source_file_relative_path}")
endif()
# If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
if(CMAKE_SWIG_OUTDIR) if(CMAKE_SWIG_OUTDIR)
set(swig_outdir ${CMAKE_SWIG_OUTDIR}) set(swig_outdir ${CMAKE_SWIG_OUTDIR})
@ -142,7 +114,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
"${swig_outdir}" "${swig_outdir}"
"${infile}") "${infile}")
set(swig_generated_file_fullname set(swig_generated_file_fullname
"${swig_generated_file_fullname}/${swig_source_file_name_we}") "${swig_outdir}/${swig_source_file_name_we}")
# add the language into the name of the file (i.e. TCL_wrap) # add the language into the name of the file (i.e. TCL_wrap)
# this allows for the same .i file to be wrapped into different languages # this allows for the same .i file to be wrapped into different languages
set(swig_generated_file_fullname set(swig_generated_file_fullname