integrating OCE into a larger cmake project

Skip to first unread message

Janus Weil

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


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


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:


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:


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 (!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,

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

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.


Richard Shaw

Mar 19, 2019, 3:55:26 PM3/19/19
I think what you're looking for is the ExternalProject module...

Reply all
Reply to author
0 new messages