Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ninja not working with CMake #15

Open
ghost opened this issue Aug 21, 2015 · 4 comments
Open

Ninja not working with CMake #15

ghost opened this issue Aug 21, 2015 · 4 comments

Comments

@ghost
Copy link

ghost commented Aug 21, 2015

Reproduce

$ mkdir build
$ cd build
$ cmake -GNinja ..
$ nina
ninja: error: 'src/rhea-prefix/lib/librhea-s.a', needed by 'output/libAqtCassowaryPlugin.so', missing and no known rule to make it

Default GNU make generator works fine though.

@ghost
Copy link
Author

ghost commented Aug 21, 2015

@ske-ableton do you have an idea of why this might be? I guess it's because the way we include third party dependencies?

@ske-ableton
Copy link
Contributor

Yes, building rhea in the aqt-cassowary build is a hack. It should be a superbuild instead, so that rhea is built with externalproject, and then aqt-cassowary is built as an external project.

Is the bundling of rhea temporary?

Here's an extension of the hack for making it work with Ninja:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 429c7ba..8e19ae8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -46,7 +46,10 @@ else()
     set(rhea_lib_location "${CMAKE_CURRENT_BINARY_DIR}/rhea-prefix/lib/librhea-s.a")
   endif()
   set_property(TARGET Rhea::Rhea PROPERTY IMPORTED_LOCATION "${rhea_lib_location}")
-  add_dependencies(Rhea::Rhea RheaBuild)
+  add_custom_command(OUTPUT "${rhea_lib_location}"
+    COMMAND ${CMAKE_COMMAND} -E echo
+    COMMENT "")
+  add_custom_target(RheaHack SOURCES "${rhea_lib_location}")
+  add_dependencies(Rhea::Rhea RheaBuild RheaHack)
   set(Rhea_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/rhea-prefix/include")
 endif()
 if(WIN32)

@ghost
Copy link
Author

ghost commented Aug 21, 2015

What is a superbuild? I think submoduling Rhea is desirable because it's a moving target and it's a small dependency anyways. What would be a solution that allows submoduling it but not relying on hacks? My knowledge of CMake is not big enough to distinguish a hack from a non-hack though 😄

@ske-ableton
Copy link
Contributor

Currently the CMakeLists for the top-level of aqt-cassowary uses externalproject to build rhea and then builds aqt-cassowary directly.

Superbuild would mean that the top level CMakeLists of aqt-cassowary would contain something like (if you excuse some pseudo-code):

ExternalProject(Rhea)
ExternalProject(aqt-cassowary 
    DEPENDS Rhea
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant