| 1 |
# |
| 2 |
# Licensed to the Apache Software Foundation (ASF) under one |
| 3 |
# or more contributor license agreements. See the NOTICE file |
| 4 |
# distributed with this work for additional information |
| 5 |
# regarding copyright ownership. The ASF licenses this file |
| 6 |
# to you under the Apache License, Version 2.0 (the |
| 7 |
# "License"); you may not use this file except in compliance |
| 8 |
# with the License. You may obtain a copy of the License at |
| 9 |
# |
| 10 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
# |
| 12 |
# Unless required by applicable law or agreed to in writing, |
| 13 |
# software distributed under the License is distributed on an |
| 14 |
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 |
# KIND, either express or implied. See the License for the |
| 16 |
# specific language governing permissions and limitations |
| 17 |
# under the License. |
| 18 |
# |
| 19 |
|
| 20 |
include(${CMAKE_ROOT}/Modules/FindSWIG.cmake) |
| 21 |
|
| 22 |
if (NOT COMMAND swig_add_library) |
| 23 |
macro (SWIG_ADD_LIBRARY name) |
| 24 |
set(options "") |
| 25 |
set(oneValueArgs LANGUAGE TYPE) |
| 26 |
set(multiValueArgs SOURCES) |
| 27 |
cmake_parse_arguments(_SAM "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) |
| 28 |
|
| 29 |
if (NOT DEFINED _SAM_LANGUAGE) |
| 30 |
message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing LANGUAGE argument") |
| 31 |
endif () |
| 32 |
|
| 33 |
if (NOT DEFINED _SAM_SOURCES) |
| 34 |
message(FATAL_ERROR "SWIG_ADD_LIBRARY: Missing SOURCES argument") |
| 35 |
endif () |
| 36 |
|
| 37 |
if (DEFINED _SAM_TYPE AND NOT _SAM_LANGUAGE STREQUAL "module") |
| 38 |
message(FATAL_ERROR "SWIG_ADD_LIBRARY: This fallback impl of swig_add_library supports the module type only") |
| 39 |
endif () |
| 40 |
|
| 41 |
swig_add_module(${name} ${_SAM_LANGUAGE} ${_SAM_SOURCES}) |
| 42 |
endmacro () |
| 43 |
endif (NOT COMMAND swig_add_library) |
| 44 |
|
| 45 |
# Builtin FindSWIG.cmake "forgets" to make its outputs advanced like a good citizen |
| 46 |
mark_as_advanced (SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION) |