[CMake] Plugins (Modules) on Windows

bpwlist at cox.net bpwlist at cox.net
Wed Mar 7 10:48:00 EST 2007


I could do that but I do not think I should have to.  That would require me to restructure a fair amount of the project.

Everything I need is already built by cmake as is it is just a linking problem that appears on windows only.

Thanks,

Bryan

---- Filipe Sousa <natros at gmail.com> wrote: 
> 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
> 
> 
> 
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list