undefind symbol in Swig python build

Hello,
I am trying to build an example swig module for Python3. The build works fine but the resulting module is not working. The symbol can not be found.

CMakeLists.txt

cmake_minimum_required(VERSION 3.12)

project(swighello)

FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})

FIND_PACKAGE(TCL)
FIND_PACKAGE(Python3 COMPONENTS Interpreter Development)
message(STATUS ${Python3_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${Python3_INCLUDE_DIR})


INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

SET(CMAKE_SWIG_FLAGS "")

SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES SWIG_FLAGS "-includeall")

add_library(mylib example.cc)
add_executable(hello hello.cc)
target_link_libraries(hello mylib)


swig_add_library(pyexample TYPE SHARED LANGUAGE python SOURCES pyexample.i example.cc)
SWIG_ADD_LIBRARY(example LANGUAGE tcl SOURCES example.i example.cc)

SWIG_LINK_LIBRARIES(pyexample ${Python3_LIBRARY} mylib)
SWIG_LINK_LIBRARIES(example ${TCL_LIBRARIES})

Pyexample.i



/* example.i */
%module pyexample
%{
  /* Put header files here or function declarations like below */

  /* extern int fact(int n); */
  #include "mylib.h"
%}

%include "mylib.h"
/*extern int fact(int n);*/

pytest.py

import pyexample

Gives

python3 pytest.py
Traceback (most recent call last):
  File "pytest.py", line 1, in <module>
    import pyexample
  File "/a/projects/swig/cmake2/build/pyexample.py", line 15, in <module>
    import _pyexample
ImportError: /a/projects/swig/cmake2/build/_pyexample.so: undefined symbol: fact