There are 2 targets (the code is simplified):
- far2m - an executable that also exports symbols, e.g.
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_executable(far2m MACOSX_BUNDLE ${SOURCES} "DE/Far.icns")
else()
add_executable(far2m ${SOURCES})
endif()
set_target_properties(far2m PROPERTIES ENABLE_EXPORTS TRUE)
- luafar - a dynamic library
add_library (luafar SHARED ${SOURCES})
target_link_libraries(luafar far2m)
This code works fine on Linux but not on MacOS. The following errors are issued:
[ 51%] Linking CXX shared library ../install/far2m.app/Contents/MacOS/Plugins/luafar/luafar.so
Undefined symbols for architecture arm64:
"_WINPORT_CloseHandle", referenced from:
_su_FileClose in sysutils.c.o
_ExtractFileTime in win.c.o
...
"_WINPORT_CompareString", referenced from:
_win_CompareString in win.c.o
"_WINPORT_CreateDirectory", referenced from:
_win_CreateDir in win.c.o
...
These undefined symbols are contained in far2m.
I have zero experience with MacOS and never had a Mac.
Could you please advise what is incorrect in my code and how it could be fixed?