flatbuffers: Don't restrict flatc to being installed only in Release mode

When building my project, I pull in flatbuffers via ExternalProject_Add with my own installation prefix specified along with whatever build type I’m doing.

My project then builds it and expects that the output folder is going to contain the static library and flatc so that it can invoke it to generate the headers from my spec file.

Currently, the install() target for flatc prevents it from being output to the installation directory on a debug build - could this either be removed, or some configurable variable provided to prevent the filtering of targets like flatc from installation just because it’s a non-release build?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15

Commits related to this issue

Most upvoted comments

One suggestion would be to alter the CMakeLists.txt and related files to make Release the default. One way to do it is described at https://blog.kitware.com/cmake-and-the-default-build-type/ . But then not have “make install” depend on build type, just let the user install whatever they built. To end up with debug in /usr/local/bin, which you seem to want to avoid, the builder would have to intentionally call cmake with -Dyada…yada to make that happen.

Much like calling autotool’s ./configure --enable-debug.

Ideally, either plain cmake -G “Unix Makefiles” or plain ./configure followed by make, make install should yield the same result. (if both cmake and autotools are set up). I think that’s the expectation most installers would have.

Regardless, I think the “Building with CMake” section on the Build page could use some more details to avoid the situation I ran into.

At the very least the “how to build” docs need to be updated to reflect what is now required to get flatc installed. (I just got burned by this.) Prior to 1.8.0, cmake -G “Unix Makefiles”, make, and make install would put flatc in /usr/local/bin. But with 1.8.0 you have to know more about cmake, and add the -DCMAKE_BUILD_TYPE=Release, since Debug is the default. Or edit the CMakeLists.txt file, which is beyond what should be expected for someone that just wants to use the package.

If you are upgrading you can easily not know this and end up with new header files but the same old flatc in bin.