integrating OCE into a larger cmake project

255 views
Skip to first unread message

Janus Weil

unread,
Aug 8, 2017, 1:31:24 PM8/8/17
to oce-dev
 Hi all,

I'm trying to include OCE as a subproject into a larger cmake-based project (with other subprojects that depend on OCE), so that the whole thing can be built via cmake in one go. I'm wondering whether this is expected to work and if someone has done it yet (and if yes, how).

In theory it could be as simply as doing

add_subdirectory(oce)

in the top-level cmake file. This does seem to work insofar as OCE is being built, but then the other subprojects do not find the OCE include files. To overcome this I tried

include_directories(oce/inc)

but this does not seem to catch all headers, since some of them seem to be found only in subdirs of oce/src. When installing OCE, all the headers are properly put into the installation directory, but I want to do an integrated build of OCE together with other libraries without having to install it first.

Another thing that might be supposed to work is:

find_package(OCE PATHS ${CMAKE_CURRENT_BINARY_DIR}/oce)

The problem with this is that the build directory contains only OCEconfig.cmake, but not OCE-libraries.cmake (which is referenced in the former), so that I get errors like:

CMake Error at build/oce/OCEConfig.cmake:23 (include):
  include could not find load file:

    ~/myproject/build/oce/OCE-libraries.cmake

Any ideas how to solve these problems are highly appreciated.

Note: I also found an older post in this mailing list on the same topic (https://groups.google.com/forum/#!topic/oce-dev/TM_xlePKFmo), which sounds like what I'm trying to do is supposed to work, but it does not give any details on how to accomplish it.

Best regards,
Janus

will....@codethink.co.uk

unread,
Sep 28, 2018, 11:41:32 AM9/28/18
to oce-dev
kicad uses cmake and has oce as a dependency, you might have some luck if you see how they did it.

Janus Weil

unread,
Mar 19, 2019, 6:58:29 AM3/19/19
to oce-dev
Thanks for the hint. However, it seems that KiCad simply requires an installed version of OCE:

find_package( OCE 0.16 REQUIRED ${OCC_LIBRARIES} )

That is the 'standard' way of handling a dependency on OCE, and I already know how to do that. What I was trying to find out is how to do a integrated build of my own project with OCE (via cmake), *without* having to install OCE first.

Cheers,
Janus

Richard Shaw

unread,
Mar 19, 2019, 3:55:26 PM3/19/19
to oce...@googlegroups.com
I think what you're looking for is the ExternalProject module...


Thanks,
RIchard 
Reply all
Reply to author
Forward
0 new messages