aboutsummaryrefslogtreecommitdiff
path: root/tests/GenerateSipBindings/CMakeLists.txt
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2017-01-14 22:13:49 +0000
committerStephen Kelly <steveire@gmail.com>2017-01-15 11:18:50 +0000
commit636d6acc7adf8bf7169d38833340161dc42d3484 (patch)
tree2ff1bbefa5808aec21e902b10c9547e359067604 /tests/GenerateSipBindings/CMakeLists.txt
parent8c347c61abafa68e247ff4664ae658cfa15af932 (diff)
downloadextra-cmake-modules-636d6acc7adf8bf7169d38833340161dc42d3484.tar.gz
extra-cmake-modules-636d6acc7adf8bf7169d38833340161dc42d3484.tar.bz2
Bindings: Fix handling of forward declarations
It is not appropriate to decorate each forward declaration with the SIP attribute /External/. That is only needed for forward declarations of types which are defined in a different module. Local forward declarations can be omitted from the sip code. In sip code, a forward declaration followed later by a full class definition is an error. Omit forward declarations unless they are decorated with the external attribute. Introduce a rules database for consumers to decorate them with the attribute as required.
Diffstat (limited to 'tests/GenerateSipBindings/CMakeLists.txt')
-rw-r--r--tests/GenerateSipBindings/CMakeLists.txt19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/GenerateSipBindings/CMakeLists.txt b/tests/GenerateSipBindings/CMakeLists.txt
index 223b2fed..c223bcef 100644
--- a/tests/GenerateSipBindings/CMakeLists.txt
+++ b/tests/GenerateSipBindings/CMakeLists.txt
@@ -10,8 +10,15 @@ set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
set(CMAKE_CXX_STANDARD 14)
+add_library(ExternalLib SHARED external_lib.cpp)
+target_link_libraries(ExternalLib PUBLIC Qt5::Core)
+target_compile_features(ExternalLib PUBLIC cxx_nullptr)
+
add_library(CppLib SHARED cpplib.cpp)
-target_link_libraries(CppLib PUBLIC Qt5::Core)
+target_link_libraries(CppLib
+ PUBLIC Qt5::Core
+ PRIVATE ExternalLib
+)
target_compile_features(CppLib PUBLIC cxx_nullptr)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../find-modules)
@@ -19,6 +26,16 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../find-modules)
find_package(PythonModuleGeneration REQUIRED)
ecm_generate_python_binding(
+ TARGET ExternalLib
+ PYTHONNAMESPACE PyTest
+ MODULENAME ExternalLib
+ SIP_DEPENDS
+ QtCore/QtCoremod.sip
+ HEADERS
+ external_lib.h
+)
+
+ecm_generate_python_binding(
TARGET CppLib
PYTHONNAMESPACE PyTest
MODULENAME CppLib