diff options
Diffstat (limited to 'Modules/UseSWIG.cmake')
-rw-r--r-- | Modules/UseSWIG.cmake | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index e4e72c2..2a09585 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -58,7 +58,7 @@ macro(SWIG_MODULE_INITIALIZE name language) elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL") set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") endif() -endmacro(SWIG_MODULE_INITIALIZE) +endmacro() # # For a given language, input file, and output file, determine extra files that @@ -71,12 +71,12 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) ${infile} SWIG_MODULE_NAME) if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE) - endif(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") + endif() foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) set(${outfiles} ${${outfiles}} "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}") - endforeach(it) -endmacro(SWIG_GET_EXTRA_OUTPUT_FILES) + endforeach() +endmacro() # # Take swig (*.i) file and add proper custom commands for it @@ -90,42 +90,42 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) get_source_file_property(swig_source_file_flags ${infile} SWIG_FLAGS) if("${swig_source_file_flags}" STREQUAL "NOTFOUND") set(swig_source_file_flags "") - endif("${swig_source_file_flags}" STREQUAL "NOTFOUND") + endif() set(swig_source_file_fullname "${infile}") 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(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") + 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(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") + 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(swig_source_file_generated) + else() set(swig_source_file_fullname "${CMAKE_CURRENT_SOURCE_DIR}/${infile}") - endif(swig_source_file_generated) - endif(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_BINARY_DIR}") - endif(${swig_source_file_path} MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}") + 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(swig_source_file_relative_path) + endif() # 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) + else() set(swig_outdir ${CMAKE_CURRENT_BINARY_DIR}) - endif(CMAKE_SWIG_OUTDIR) + endif() SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE} swig_extra_generated_files "${swig_outdir}" @@ -140,10 +140,10 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) if(swig_source_file_cplusplus) set(swig_generated_file_fullname "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}") - else(swig_source_file_cplusplus) + else() set(swig_generated_file_fullname "${swig_generated_file_fullname}.c") - endif(swig_source_file_cplusplus) + endif() #message("Full path to source file: ${swig_source_file_fullname}") #message("Full path to the output file: ${swig_generated_file_fullname}") @@ -151,17 +151,17 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) set(swig_include_dirs) foreach(it ${cmake_include_directories}) set(swig_include_dirs ${swig_include_dirs} "-I${it}") - endforeach(it) + endforeach() set(swig_special_flags) # default is c, so add c++ flag if it is c++ if(swig_source_file_cplusplus) set(swig_special_flags ${swig_special_flags} "-c++") - endif(swig_source_file_cplusplus) + endif() set(swig_extra_flags) if(SWIG_MODULE_${name}_EXTRA_FLAGS) set(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) - endif(SWIG_MODULE_${name}_EXTRA_FLAGS) + endif() add_custom_command( OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files} # Let's create the ${swig_outdir} at execution time, in case dir contains $(OutDir) @@ -182,7 +182,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files} PROPERTIES GENERATED 1) set(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files}) -endmacro(SWIG_ADD_SOURCE_TO_MODULE) +endmacro() # # Create Swig module @@ -194,16 +194,16 @@ macro(SWIG_ADD_MODULE name language) foreach(it ${ARGN}) if(${it} MATCHES ".*\\.i$") set(swig_dot_i_sources ${swig_dot_i_sources} "${it}") - else(${it} MATCHES ".*\\.i$") + else() set(swig_other_sources ${swig_other_sources} "${it}") - endif(${it} MATCHES ".*\\.i$") - endforeach(it) + endif() + endforeach() set(swig_generated_sources) foreach(it ${swig_dot_i_sources}) SWIG_ADD_SOURCE_TO_MODULE(${name} swig_generated_source ${it}) set(swig_generated_sources ${swig_generated_sources} "${swig_generated_source}") - endforeach(it) + endforeach() get_directory_property(swig_extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${swig_extra_clean_files};${swig_generated_sources}") @@ -221,8 +221,8 @@ macro(SWIG_ADD_MODULE name language) # Windows: LIBRARY.dll # Linux : libLIBRARY.so set_target_properties (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib") - endif (APPLE) - endif ("${swig_lowercase_language}" STREQUAL "java") + endif () + endif () if ("${swig_lowercase_language}" STREQUAL "python") # this is only needed for the python case where a _modulename.so is generated set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") @@ -236,9 +236,9 @@ macro(SWIG_ADD_MODULE name language) # </quote> if(WIN32 AND NOT CYGWIN) set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd") - endif(WIN32 AND NOT CYGWIN) - endif ("${swig_lowercase_language}" STREQUAL "python") -endmacro(SWIG_ADD_MODULE) + endif() + endif () +endmacro() # # Like TARGET_LINK_LIBRARIES but for swig modules @@ -246,8 +246,8 @@ endmacro(SWIG_ADD_MODULE) macro(SWIG_LINK_LIBRARIES name) if(SWIG_MODULE_${name}_REAL_NAME) target_link_libraries(${SWIG_MODULE_${name}_REAL_NAME} ${ARGN}) - else(SWIG_MODULE_${name}_REAL_NAME) + else() message(SEND_ERROR "Cannot find Swig library \"${name}\".") - endif(SWIG_MODULE_${name}_REAL_NAME) -endmacro(SWIG_LINK_LIBRARIES name) + endif() +endmacro() |