[CMake] Darwin, shared libraries, and undefined symbols
Brad King
brad.king at kitware.com
Wed Mar 23 08:07:00 EST 2005
Zachary Pincus wrote:
> Some time ago (~CMake 1.6 or 1.8?), the Modules/Platform/Darwin.cmake
> file defined
> CMAKE_SHARED_MODULE_CREATE_C_FLAGS
> to contain
> -bundle -flat_namespace -undefined suppress
[snip]
> So: what is the preferred way to deal with undefined symbols?
> Darwin-specific stuff in a CMakeLists file? (And if so, hat stuff?
> specifying a bundle_loader? Setting some -undefined handler?) Or is
> there a better cross-platform way to deal with making such libraries?
> Clearly there is some way because SWIG-wrapped python libs get made
> properly in Darwin...
CMake will pay attention to the last setting of this variable it sees in
a directory. The modules directory code just initializes it. You can
write code to set the variable to whatever you want:
IF(APPLE)
SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
"${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined
suppress")
ENDIF(APPLE)
The preferred way to deal with undefined symbols is to not have any
because DLLs on windows must be fully resolved at link time.
-Brad
More information about the CMake
mailing list