[CMake] Plugins (Modules) on Windows
Filipe Sousa
natros at gmail.com
Tue Mar 6 14:20:15 EST 2007
bpwlist at cox.net wrote:
> Hi All,
>
> I have a project in which I build a main application and several plugins (modules). My main cmake file look something like this:
>
> ADD_SUBDIRECTORY(MainApp)
> ADD_SUBDIRECTORY(plugins/Plugin1)
> ADD_SUBDIRECTORY(plugins/Plugin2)
> ...
>
> Plugin1 cmakes file looks like this:
> PROJECT(Plugin1)
> INCLUDE_DIRECTORIES(
> .
> ${CMAKE_SOURCE_DIR}/MyApp
> )
>
> SET (SRCS foo.cpp)
>
> ADD_LIBRARY(Plugin1 MODULE ${SRCS})
>
> MyApp's Cmake file looks like this:
>
> PROJECT(MyApp)
> SET (SRCS bar.cpp)
> ADD_EXECUTABLE(MyApp ${SRCS}
>
> This works great on linux. But under windows I get several unresolved symbols. Under linux the symbols are resolved when the module is loaded by MyApp, under windows the symbols are trying to be resolved by the linker. I can fix this in Visual Studio by adding MyApp.lib to the list of dependencies. MyApp.lib is generated as a side effect of VS building the executable. When I try add MyApp.lib under cmake it appears to get confused. (since MyApp is a executable not a library) What is the right way of doing this?
>
> Thanks,
>
> Bryan Walsh
Why don't you move the common code to a separated library? Then you
could link your application and the plugins with that library.
-- Filipe Sousa
More information about the CMake
mailing list