Re: [CMake] Multiple "projects" one directory

2018-04-27 Thread J Decker
You can solve this by treating those local projects as external projects;
then they can be built with independant flags

include( ExternalProject )

https://github.com/d3x0r/SACK/blob/master/CMakeLists.txt#L1769

ExternalProject_Add( ppc_portable
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/makefiles/prog/ppc
BINARY_DIR ppc_portable
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
BUILD_ALWAYS 1
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
..
 (more args...) )

I find, because it's a local project; the build_always is kinda required,
if you make changes to the sources it doesn't even check to see if it needs
to build without BUILD_ALWAYS.


On Fri, Apr 27, 2018 at 3:06 PM, Scott Bloom  wrote:

> I have a rather complicated Qt based project.
>
>
>
> We are looking at rolling out a subset tool, and it will be significantly
> smaller in functionality.
>
>
>
> For that mode, I would like to set a CMake variable LITEVERSION that
> builds the tool with -DLITEVERSION defined.
>
> however, one (or two) folders, the main executable (and possibly the main
> window folder), and I would like include into the tool with this turned on,
> and with it turned off
>
>
>
> Is that possible?
>
>
>
> Other times I have done this, I just have two build areas.. But 90% of
> this code base is the same, and will be built independent of the flag. So
> Id rather not build it twice
>
>
>
> Scott
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] Multiple "projects" one directory

2018-04-27 Thread Scott Bloom
I have a rather complicated Qt based project.

We are looking at rolling out a subset tool, and it will be significantly 
smaller in functionality.

For that mode, I would like to set a CMake variable LITEVERSION that builds the 
tool with -DLITEVERSION defined.

however, one (or two) folders, the main executable (and possibly the main 
window folder), and I would like include into the tool with this turned on, and 
with it turned off

Is that possible?

Other times I have done this, I just have two build areas.. But 90% of this 
code base is the same, and will be built independent of the flag. So Id rather 
not build it twice

Scott
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Help Accommodating Ninja when including CMAKE_CURRENT_BINARY_DIR

2018-04-27 Thread Robert Maynard
I recommend going with the custom target / custom command route.

On Fri, Apr 27, 2018 at 5:19 AM, Stephen McDowell 
wrote:

> Upon further inspection, it seems more related to PRE_BUILD.  The step to
> generating the files is through a add_custom_command call, which from the
> docs apparently may end up being PRE_LINK.
>
> I tried generating into the ${CMAKE_CURRENT_SOURCE}/include/nanogui,
> which will work for Makefiles but not for Ninja.
>
> So it seems that maybe this is not a pathing issue at all, but instead an
> order of operations issue.  If the Ninja generator ends up having this as
> PRE_LINK, the files haven’t been generated yet.
>
> That doesn’t quite explain why it worked previously, but perhaps the
> original setup was inherently flawed by relying on PRE_BUILD which is not a
> guaranteed order.
>
> Does anybody have thoughts on how to change things?  The files cannot be
> compiled on their own, but maybe I should instead create a fake target and
> make it a dependency of the real (object) library that needs them.  I keep
> messing that up, but this seems the most promising.
>
> -Stephen
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] cmake --find-package deprecated?

2018-04-27 Thread Jeandet Alexis
Hi Alexander, all,

here is a WIP patch
https://gitlab.kitware.com/cmake/cmake/merge_requests/2017

Any advise, help on how to improve this is welcome.

Alexis.
On Tue, 2018-04-03 at 22:00 +0200, Alexander Neundorf wrote:
> On 2018 M04 3, Tue 16:01:58 CEST jeandet wrote:
> > Hi all,
> > 
> > Reading the documentation I can see:
> > https://cmake.org/cmake/help/v3.11/manual/cmake.1.html?highlight=fi
> > nd%2
> > 0package#find-package-tool-mode id="-x-evo-selection-start-marker">
> > "
> > Note
> > 
> > This mode is not well-supported due to some technical limitations.
> > It
> > is kept for compatibility but should not be used in new projects.
> > "
> > 
> > Does this means that:
> >   1) We will always support this but it's limited.
> >   2) We will be supported for a long time, but you shouldn't use
> > it.
> >   3) We plan to remove this soon, don't use this!
> 
> I think it's in 2).
>  
> > In fact this mode would really be useful outside of CMake, to use
> > libraries/stuff which doesn't provide pc files but only CMake
> > packages.
> > Even if this has limitations, it's better than nothing.
> 
> Yes, that was my motivation a few years back.
> There is even a cmake.m4 which adds a cmake_find_package macro for
> configure.
> 
> Since then, there was close to no feedback.
> I also can't remember any volunteer contributions for this feature.
> Currently it has more limitations than it had 7 or 8 years ago or so.
> 
> The idea was to run cmake in script mode, and basically just execute
> the 
> requested FindFoo.cmake script, which basically searches a set of
> directories 
> and returns the results.
> With imported targets, their link interfaces and e.g. generator
> expressions 
> things got more complicated.
> 
> I'd be happy if somebody picks up the work and makes this feature
> work 
> properly.
> 
> Alex
> 
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Help Accommodating Ninja when including CMAKE_CURRENT_BINARY_DIR

2018-04-27 Thread Stephen McDowell
Upon further inspection, it seems more related to PRE_BUILD.  The step to 
generating the files is through a add_custom_command call, which from the docs 
apparently may end up being PRE_LINK.

I tried generating into the ${CMAKE_CURRENT_SOURCE}/include/nanogui, which will 
work for Makefiles but not for Ninja.

So it seems that maybe this is not a pathing issue at all, but instead an order 
of operations issue.  If the Ninja generator ends up having this as PRE_LINK, 
the files haven’t been generated yet.

That doesn’t quite explain why it worked previously, but perhaps the original 
setup was inherently flawed by relying on PRE_BUILD which is not a guaranteed 
order.

Does anybody have thoughts on how to change things?  The files cannot be 
compiled on their own, but maybe I should instead create a fake target and make 
it a dependency of the real (object) library that needs them.  I keep messing 
that up, but this seems the most promising.

-Stephen

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] Help Accommodating Ninja when including CMAKE_CURRENT_BINARY_DIR

2018-04-27 Thread Stephen McDowell
Hello,

I have looked around and seen a few issues discussing this, but have not seen 
any solutions.

It seems related to this: https://gitlab.kitware.com/cmake/cmake/issues/17450 


In the sense that absolute paths are desired.

1. Previously, we were generating a file called 
`${CMAKE_CURRENT_BINARY_DIR}/nanogui_resources.h` and performing 
`include_directories(${CMAKE_CURRENT_BINARY_DIR})`.

This **works correctly**.

2. The setup was changed to generate the file 
`${CMAKE_CURRENT_BINARY_DIR}/nanogui/resources.h`.  That is, the introduction 
of a new folder `nanogui`.  With the same 
`include_directories(${CMAKE_CURRENT_BINARY_DIR})`, there is now a failure 
being unable to find ``.

Strangely, building with `ninja || ninja` (just building again after first 
failure) will succeed.

I was reading this discussion: 
https://public.kitware.com/pipermail/cmake-developers/2013-March/018398.html 


and the underlying cause seems to be the that Ninja wants relative paths.

Why is creating this sub-directory causing this issue?  Is there a way to keep 
generating ${CMAKE_CURRENT_BINARY_DIR}/nanogui and be able to include it with 
Ninja?  I tried forcing a add_definitions(-I${CMAKE_CURRENT_BINARY_DIR}) just 
for shiggles, but that resulted in the same scenario.  So it seems like I need 
a way to force a verbatim include path “after” the Ninja generator makes things 
relative?

Reverting to the old version is not ideal, since it creates installation 
problems (the reason the subdirectory nanogui was created).

Thank you for any advice!

-Stephen

P.S. This is with CMake 3.11.1 and ninja 1.8.2 if it matters.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake