Re: [CMake] Dependency managment

2018-12-12 Thread Attila Krasznahorkay
Hi Gabriele, What do you mean exactly by "we can compile libA but we cannot compile libB without installing libA because the latter needs it"? o.O Are you trying to find libA in libs/libB/CMakeLists.txt with find_package(...)? "Normal" targets (libraries and executables) should be globally

[CMake] DEPFILE usage in add_custom_command(...)

2018-12-12 Thread Attila Krasznahorkay
Dear All, I'm trying to use the DEPFILE argument of add_custom_command(...) to be able to tell Ninja exactly when it should re-run that custom command. But unfortunately I'm not able to get it to work as I'd like. :-( I'm running a custom command that processes a header file through a custom

Re: [cmake-developers] why can target_include_directories() not be applied to custom targets?

2018-07-09 Thread Attila Krasznahorkay
Hi, Just to say that setting INCLUDE_DIRECTORIES on a custom target is indeed a bit of an obscure thing, but we do use it. You can find the full reasoning in: https://gitlab.kitware.com/cmake/cmake/issues/16830 Because of that, I understood that CMake will provide this functionality in the

[CMake] Incremental builds with ExternalProject_Add

2018-03-15 Thread Attila Krasznahorkay
Dear All, I ran into an issue with incremental builds that use ExternalProject_Add(...), which I'm very surprised isn't a more widely advertised issue. So I thought I'd ask here if people are aware of this behaviour... For our software projects we build a good number of externals using

Re: [CMake] AUTOMOC with files on different folders

2016-05-12 Thread Attila Krasznahorkay
Hi Tiago, Indeed, that page is quite a bit misleading. And it seems to be "liked" by Google a lot, as most people come across it. (I also found it myself when looking for CMake documentation early on.) In general, listing all source files belonging to a library/executable, even the ones that

Re: [CMake] AUTOMOC with files on different folders

2016-05-11 Thread Attila Krasznahorkay
Hi Tiago, This is one of those cases when you have to declare the header files to add_library(...) as well. In that case AUTOMOC should work fine. At least it does for us, in a very similar setup. http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/graphics/VP1/VP1Gui/CMakeLists.txt Cheers,

Re: [CMake] Cannot include third-party Framework headers directories as system directories in XCode for avoiding their warning

2016-05-11 Thread Attila Krasznahorkay
Hi, I'm a bit surprised by this. I had to explicitly tell CMake not to treat includes coming from imported targets as system includes. Using this variable: https://cmake.org/cmake/help/v3.0/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED.html

Re: [CMake] Running cpack without source folder

2016-05-10 Thread Attila Krasznahorkay
Hi, If you run the cpack executable directly, it should not reconfigure/rebuild your project. As far as I know... How do you run it now? "make package"? That will reconfigure/rebuild the project not really because of CPack, but because of how the Makefiles are set up. Cheers,

Re: [CMake] Difference between PRIVATE and PUBLIC with target_link_libraries

2016-05-10 Thread Attila Krasznahorkay
Hi Patrick, I *think* that these public/private rules behave a bit differently for static libraries than they do for shared ones. But I have to admit, that based on this code I also would've guessed that -I/tmp would not show up in the build of exe1... I did manage to use public and private

[CMake] Override CMAKE_SHARED_LINKER_FLAGS for one particular library

2016-05-02 Thread Attila Krasznahorkay
Dear All, I have a similar issue as Matt Keeler. In our project we have some global linker flags that we set for all targets using the CMAKE_EXE_LINKER_FLAGS, CMAKE_SHARED_LINKER_FLAGS and CMAKE_MODULE_LINKER_FLAGS cache variables. Now it turns out that for some libraries in the project I need

Re: [CMake] LINK_FLAGS directory property

2016-05-02 Thread Attila Krasznahorkay
Hi Matt, Have you tried using the CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS cache variables? These actually set these flags globally, and not just for one directory, but on the directory level they are easy to override. You can just do something like this in a

Re: [CMake] Documenting CMakeLists.txt and custom or local .cmake files

2016-04-07 Thread Attila Krasznahorkay
Hi Philip, Unfortunately I can't give any insight on this. I just wanted to express my own interest in this question. As we'd also very much need a convenient way to document our CMake code. (Currently it's done on a Wiki page, which is out of date within 5 minutes of it being updated...)

[CMake] Check the existence of a header / ability to compile source file

2016-04-05 Thread Attila Krasznahorkay
Dear All, I'm stumped on the following, seemingly simple issue. I need to figure out in my configuration whether a given header file will be available when I'll try to build my library, or not. So that I could set a particular definition for the compiler according to whether the file is

Re: [cmake-developers] CPackRPM not dealing correctly with symlinks

2016-03-29 Thread Attila Krasznahorkay
so please replace the file in your 3.5.0 version of > CMake. > > Thanks, > Domen > > 2016-03-24 9:48 GMT+01:00 Attila Krasznahorkay > <attila.krasznahor...@gmail.com>: >> Hi Domen, >> >> Unfortunately I can't seem to create an easy-to-package exam

Re: [cmake-developers] CPackRPM not dealing correctly with symlinks

2016-03-24 Thread Attila Krasznahorkay
at how this could be solved for later versions of CPack. > Do I understand correctly that those errors occur when a symlink is > pointing to another simlink outside your project? > Could you please provide a minimal example of all your cases? > > Thanks, > Domen > > > 2016

Re: [cmake-developers] Patch to only consider build dependencies between files in the source directory

2016-03-24 Thread Attila Krasznahorkay
Hi Brad, Thanks! Looks good. Cheers, Attila > On 23 Mar 2016, at 19:05, Brad King <brad.k...@kitware.com> wrote: > > On 03/22/2016 08:23 AM, Attila Krasznahorkay wrote: >> Here is my next attempt. ;-) Hopefully I'm at least getting closer... > > Thanks.

Re: [cmake-developers] CPackRPM not dealing correctly with symlinks

2016-03-23 Thread Attila Krasznahorkay
a2af70d;hb=HEAD#l994 Cheers, Attila > On 23 Mar 2016, at 13:50, Brad King <brad.k...@kitware.com> wrote: > > On 03/23/2016 08:44 AM, Attila Krasznahorkay wrote: >> CMake Error at /afs/cern.ch/sw/lcg/contrib/CMake/3.3.2/... > > Please try with C

[cmake-developers] CPackRPM not dealing correctly with symlinks

2016-03-23 Thread Attila Krasznahorkay
Dear All, Not sure what's the best way to post this issue, so I thought I'd send around an e-mail first. We've been struggling with some RPM building errors in some of our projects for a while now. Finally I was able to understand what the cause of the issue is. In some cases we put symbolic

Re: [cmake-developers] Patch to only consider build dependencies between files in the source directory

2016-03-22 Thread Attila Krasznahorkay
ir" , not > "my/srcSiblingDir" > > > > > On Fri, Mar 18, 2016 at 11:52 AM, Attila Krasznahorkay > <attila.krasznahor...@gmail.com> wrote: >> Hi Brad, >> >>>> + // If it's an absolute path, check if it starts with the

Re: [cmake-developers] Patch to only consider build dependencies between files in the source directory

2016-03-19 Thread Attila Krasznahorkay
: Binary data > On 15 Mar 2016, at 19:13, Brad King <brad.k...@kitware.com> wrote: > > On 03/15/2016 10:48 AM, Attila Krasznahorkay wrote: >> https://cmake.org/pipermail/cmake-developers/2015-December/027197.html >> >> With the following patch, when setting the

Re: [cmake-developers] Patch to only consider build dependencies between files in the source directory

2016-03-18 Thread Attila Krasznahorkay
Hi Brad, >> + // If it's an absolute path, check if it starts with the source >> + // direcotory: >> + return ( ( path.find( SourceDir ) != 0 ) && >> + ( path.find( BinaryDir ) != 0 ) ); > > Please look at using strncmp and a check that the following character > is a

Re: [cmake-developers] Patch to only consider build dependencies between files in the source directory

2016-03-16 Thread Attila Krasznahorkay
Hi Brad, All valid points. Will try to make a new patch today. Cheers, Attila > On 15 Mar 2016, at 19:13, Brad King <brad.k...@kitware.com> wrote: > > On 03/15/2016 10:48 AM, Attila Krasznahorkay wrote: >> https://cmake.org/pipermail/cmake-developers/2015

[cmake-developers] Patch to only consider build dependencies between files in the source directory

2016-03-15 Thread Attila Krasznahorkay
Dear All, I've already talked about this a bit back in December. https://cmake.org/pipermail/cmake-developers/2015-December/027197.html I looked at this issue today again, as in our builds we can be seriously hampered by "cmake -E cmake_depends" calls. And then, by the huge dependency trees

Re: [cmake-developers] C++11 only for a specified subdirectory

2016-03-08 Thread Attila Krasznahorkay
Hi Roman, If you only set set( CMAKE_CXX_STANDARD 11 ) in that subdirectory, then this should happen automatically. (Since the variable will not be visible as soon as you go out of the scope of this "subdirectory".) Otherwise you could just set the CXX_STANDARD property on the targets that

Re: [CMake] CMake 3.5-CMAKE_BINARY_DIR is set to ${CMAKE_SOURCE_DIR} when calling add_subdirectory?

2016-02-22 Thread Attila Krasznahorkay
Hi Gerry, Setting these variables by hand sounds quite dangerous. I'm not sure how much this is meant to be supported. There is a much more "native" way of doing this. You could do: add_subdirectory( ${source_dir} ${binary_dir} ) , where "source_dir" would be the source directory relative to

Re: [CMake] CMAKE_MODULE_PATH ignored

2016-02-09 Thread Attila Krasznahorkay
Hi, I myself use statements like: list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/modules ) at the beginning of my main CMakeLists.txt file, and it works exactly as one would expect. I also override some CMake provided modules like this. Cheers, Attila > On 08 Feb 2016, at

Re: [CMake] Stopping CPack from compiling python files

2016-01-29 Thread Attila Krasznahorkay
Thanks for the suggestions! I'll give it a try. Cheers, Attila > On 28 Jan 2016, at 14:07, Domen Vrankar wrote: > >> Not sure how we can disable such script call from CPackRPM unless adding the >> extra feature to call >> rpm/rpmbuild wiht appropriate

[CMake] Stopping CPack from compiling python files

2016-01-28 Thread Attila Krasznahorkay
Dear All, This should be a simple question, but somehow I don't seem to find an answer to it with Google. Our projects have a lot of python files in them. Many of which are not simple python files. They are files that need our software to interpret them. So CPack should just leave them alone.

Re: [CMake] Creating RPMs from failing projects with CPack

2016-01-21 Thread Attila Krasznahorkay
LL_COMMANDS "${CMAKE_CURRENT_SOURCE_DIR}/install_k.sh") > > And instead of packaging with "make package" command execute "cpack -G RPM". > > However there is an additional problem that this hack only works for > monolithic packages (that's why I c

[CMake] Creating RPMs from failing projects with CPack

2016-01-20 Thread Attila Krasznahorkay
Dear All, I have a slightly unusual question (I guess). Is it possible somehow to force CPack to produce RPM files from projects that have build problems? We use CMake in our nightly build system to test the latest changes in our software. When a build problem occurs we don't want the whole

Re: [CMake] adding parts of build log to dashboard.

2016-01-07 Thread Attila Krasznahorkay
Hi Rashad, It may not be the perfect way of doing it, but I attach build log files as "notes". With something like: set( CTEST_NOTES_FILES ${CTEST_BINARY_DIRECTORY}/BuildLogs/log1.log ... ) ctest_submit( PARTS Build Notes ) (I actually do something rather more complicated. I split the build

Re: [CMake] Get target name from command line for IF statement

2016-01-04 Thread Attila Krasznahorkay
Hi Yann, I have no idea what LINKER_SCATTER_FILE does, but... if( TARGET ) is a check that will evaluate to true if a target named *exists*. In this configuration neither "target_1" or "target_2" exist at the point when you run this check. So LINKER_SCATTER_FILE will always be set to

Re: [CMake] I can not set CMAKE_BUILD_TYPE in CMakeList.txt

2016-01-04 Thread Attila Krasznahorkay
Hi Isaac, ccmake will only allow you to modify cache variables. When you call set( CMAKE_BUILD_TYPE RelWithDebInfo ) , this creates a local variable in your CMakeLists.txt file. This way it should *always* override whatever you set on the command line, or as a cache variable. If you want to

Re: [CMake] organizing source files with CMake

2015-12-17 Thread Attila Krasznahorkay
Hi Victor, (Without a name I don't have anything better to go on here...) You could do the following in your subdirectory's CMakeLists.txt file: set( SOURCE ${SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/file1.cpp ... ) set( SOURCE ${SOURCE} PARENT_SCOPE ) The second line will make sure that the

Re: [cmake-developers] Restriction on target types for GraphViz dependency graph generation

2015-12-16 Thread Attila Krasznahorkay
Hi Andrey, I would be extremely happy with an extension to this functionality. Right now I have way too many targets in my projects to make good sense of them if all of them are put into a single graph. If I would be able to specify that I'd like to see the connections between all the targets

Re: [cmake-developers] [CMake] How to set _default_ timeout for the ctest command? (fwd)

2015-12-14 Thread Attila Krasznahorkay
Hi Alan, Are you just looking for the TIMEOUT property on the tests? https://cmake.org/cmake/help/v3.0/command/set_tests_properties.html This is something that I managed to find with the most basic google-ing myself. :-/ And I use it like: set_tests_properties( ${testName}Test PROPERTIES

Re: [cmake-developers] Proposal to teach cmDepends to only take dependencies from the source tree

2015-12-14 Thread Attila Krasznahorkay
the addition of this new feature. Cheers, Attila > On 09 Dec 2015, at 15:38, Ben Boeckel <ben.boec...@kitware.com> wrote: > > On Wed, Dec 09, 2015 at 09:19:45 +0100, Attila Krasznahorkay wrote: >> I myself am on the side of simplicity. Using regular expressi

Re: [CMake] Parallel jobs failed for cmake

2015-12-14 Thread Attila Krasznahorkay
Hi Igor, At this point it's really not a CMake question, but a GNU Make one... The answer is actually right there in the first warning that you got. make[4]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule. I have to admit that I'm not absolutely sure about all the

Re: [CMake] what options

2015-12-14 Thread Attila Krasznahorkay
Hi, Just to clarify: CMAKE_INSTALL_PREFIX is the variable that sets where the project will be installed. CMAKE_PREFIX_PATH is used (amongst other things) to find external projects during the configuration. Cheers, Attila > On 13 Dec 2015, at 21:20, Owen Hogarth II

[CMake] Figuring out in a generator expression whether a name is a target

2015-12-11 Thread Attila Krasznahorkay
Dear All, I'm trying to do something a bit more complicated, so please bear with me... In our project we use a special kind of source code generator. Called a "dictionary generator". (https://root.cern.ch/how/how-use-reflex) To simplify the life of our users a bit, we provide a helper function

Re: [CMake] Figuring out in a generator expression whether a name is a target

2015-12-11 Thread Attila Krasznahorkay
brary takes care of collecting the include directories from the entities that provide such a thing. Cheers, Attila > On 11 Dec 2015, at 12:58, Attila Krasznahorkay > <attila.krasznahor...@gmail.com> wrote: > > Dear All, > > I'm trying to do something a bit

Re: [CMake] CPack and PackageMaker

2015-12-11 Thread Attila Krasznahorkay
Hi Robert, I'm afraid that the sad situation is that nobody has done this yet, or is working on it at the moment. I'm absolutely sure that if you can help with this by any amount, that will be most welcome by the CMake developers. It will certainly be most welcome by me, as I've been

Re: [CMake] How to set environment variables with spaces in commands

2015-12-10 Thread Attila Krasznahorkay
portable. Even if my current project will not work on Windows for a lot of reasons anyway... Cheers, Attila > On 10 Dec 2015, at 13:38, Ruslan Baratov <ruslan_bara...@yahoo.com> wrote: > > On 10-Dec-15 12:52, Attila Krasznahorkay wrote: >> Hi QP, >> &g

Re: [CMake] How to set environment variables with spaces in commands

2015-12-09 Thread Attila Krasznahorkay
Hi QP, Probably not the intended solution, but what I’m doing in such cases is that in a patch step I create a shell script that does the configuration for me. With all the environment settings and everything. Like: PATCH_COMMAND ${CMAKE_COMMAND} -E echo “cd someDir/; CC=\”something\”

Re: [CMake] organizing includes statements

2015-12-09 Thread Attila Krasznahorkay
Hi Owen, This seems like a textbook example of using target_include_directories(…) with generator expressions. Let’s take the example where: lib1/headers/lib1.h lib1/lib1.c lib2/headers/lib2.h lib2/lib2.c If you want to be able to include lib1.h and lib2.h with simply #include “lib1.h” and

[cmake-developers] Proposal to teach cmDepends to only take dependencies from the source tree

2015-12-08 Thread Attila Krasznahorkay
Dear All, In our software infrastructure I now got to the point that in building "high level" packages/projects the CMake build spends a very noticeable amount of time in calculating the dependencies of source files. To give you a feel of the issue, in one example that I was profiling, I build

Re: [CMake] Control the build target's external dependencies

2015-12-07 Thread Attila Krasznahorkay
ncy calculation. Should one open a bug report with this? (Does the CMake bug tracking system have the ability to track "feature requests"?) Cheers, Attila > On 07 Dec 2015, at 11:55, Attila Krasznahorkay > <attila.krasznahor...@gmail.com> wrote: > > Dear

[CMake] Making CMake *not* use -isystem at all

2015-12-07 Thread Attila Krasznahorkay
Dear All, I'm still debugging the performance problems of our build. But now I bumped into another surprising thing. Our "highest level" packages can depend on a *lot* of low level packages. The one I'm testing now depends on more than 180 of them. This generates >180 -isystem flags for the

[CMake] Control the build target's external dependencies

2015-12-07 Thread Attila Krasznahorkay
Dear All, I'm struggling since a few days with the following issue. Our development setup is such that we build large software projects in a nightly build system, which puts these projects onto a network drive. The developers then set up these nightly projects, and build their own code against

Re: [CMake] Control the build target's external dependencies

2015-12-07 Thread Attila Krasznahorkay
boost files in my dependency list. Any suggestion for how I could express my intent in a regular expression that CMake would understand? Cheers, Attila > On 07 Dec 2015, at 10:57, Attila Krasznahorkay > <attila.krasznahor...@gmail.com> wrote: > > Dear All, > &

Re: [CMake] Making CMake *not* use -isystem at all

2015-12-07 Thread Attila Krasznahorkay
015, at 10:05 PM, Alexander Neundorf <a.neundorf-w...@gmx.net> > wrote: > > On Monday, December 07, 2015 15:39:40 Attila Krasznahorkay wrote: > > Dear All, > > > > I'm still debugging the performance problems of our build. But now I bumped > > into another sur

[CMake] Adding required source files to a custom target

2015-12-03 Thread Attila Krasznahorkay
Dear All, Is it possible to add additional source files to an already existing custom target? My project needs to generate a number of "different things", which it does by setting up many custom commands. In order to trigger the generation of everything, I currently need to set up an

Re: [CMake] Adding required source files to a custom target

2015-12-03 Thread Attila Krasznahorkay
Hi Nils, Clever. I didn't even consider specifying the SOURCES argument of the custom target with a generator expression. But it seems to work perfectly. Thanks! Attila > On 03 Dec 2015, at 16:00, Nils Gladitz <nilsglad...@gmail.com> wrote: > > On 12/03/2015 0

Re: [CMake] generator expression for set_target_properties

2015-12-02 Thread Attila Krasznahorkay
Hi Lloyd, You mean like: if( ${CMAKE_BUILD_TYPE} STREQUAL "Release" ) set_target_properties( myexec PROPERTIES WIN32_EXECUTABLE TRUE ) endif() ? Or would you like the build configuration to change in this respect when you change the build type in the IDE? This latter may not be possible to

[CMake] Custom command concurrency

2015-11-30 Thread Attila Krasznahorkay
Dear All, I'm running into a new issue with my custom commands. :-( I have a project with many subdirectories. Where most subdirectories generate some files during the build. Some of which need to be merged into a single file at the end of the build. In my current implementation the

Re: [CMake] Imported ExternalProject Libraries with Ninja

2015-11-22 Thread Attila Krasznahorkay
Hi Zac, In recent versions of CMake (not sure when it was introduced, but it's available in 3.2.X) you have an extra argument for ExternalProject_Add: BUILD_BYPRODUCTS. https://cmake.org/cmake/help/v3.2/module/ExternalProject.html I use this in a setup very similar to yours to declare all the

Re: [CMake] How to depend on files generated in a subdirectory?

2015-11-19 Thread Attila Krasznahorkay
Hi Zac, Interesting. I was convinced that it wouldn't work with Ninja. But it does. Thanks! Attila > On 19 Nov 2015, at 00:23, Zac Bergquist <zbergquis...@gmail.com> wrote: > > Would this work? > > add_dependencies(MergeFiles SubdirTarget) > > On Nov

[CMake] How to depend on files generated in a subdirectory?

2015-11-18 Thread Attila Krasznahorkay
Dear All, I'm trying to do something that may be very easy to implement, but I'm really struggling with it at the moment... I have a project in which I generate various files in subdirectories. Which I add to the main project file using add_subdirectory(...). Some of these files I need to

Re: [CMake] Custom message if target fails

2015-11-14 Thread Attila Krasznahorkay
Hi Daniel, You could even do it in a *much* more general way. We write custom log files about our builds by providing a "replacement" for the ctest executable. So that when we configure the build with -DCTEST_USE_LAUNCHERS , our script would catch *all* the build commands. (To have a chance

Re: [CMake] The project files that CMake generates can't be moved

2015-10-30 Thread Attila Krasznahorkay
Hi, I'm a bit surprised about this answer. Sure, build areas are not to be moved around. I completely agree. But this is why we have the concept of installing releases. As long as you configure your build correctly, you should be able to move around your install directory. As the binaries by

[CMake] How to figure out the "type" of an imported library

2015-10-29 Thread Attila Krasznahorkay
Dear All, In my code I'm trying to do something slightly tricky. I include packages that provide imported libraries (amongst other things). Then, because of how my project is structured, I don't make use of the imported libraries directly, but first make "copies" of them, and then make use of

Re: [CMake] How to figure out the "type" of an imported library

2015-10-29 Thread Attila Krasznahorkay
gt; On Thu, Oct 29, 2015 at 4:53 PM, Attila Krasznahorkay > <attila.krasznahor...@gmail.com> wrote: > Dear All, > > In my code I'm trying to do something slightly tricky. I include packages > that provide imported libraries (amongst other things). Then, because of how

Re: [CMake] Removing duplicate entries from CXXFLAGS

2015-10-06 Thread Attila Krasznahorkay
XX_FLAGS is deduplicated. But I consider this > variable as global flags for the whole project which is defined at topmost > CMakeLists.txt. If you need to specify some flags specifically for a target > use target_compile_options. > > — > Sent from Mailbox > >

[CMake] Removing duplicate entries from CXXFLAGS

2015-10-05 Thread Attila Krasznahorkay
Dear All, Let me try a simpler question this time. (I'm a bit disappointed that nobody had any comments on my question about sub-projects.) I'm trying to clean up my project's build a bit. As it collects compilation flags from a few separate places, by the time it finishes collecting

[CMake] Associating a single build step with multiple sub-projects in CDash

2015-09-29 Thread Attila Krasznahorkay
Dear All, After the suggestion from Bill Hoffman, I played with CDash for a while now. I was able to create a ctest script that would build the packages/subdirectories of my project one by one, and then upload the build/test results to a CDash server. With the results being quite user friendly

[CMake] Build log generation in a "custom" way

2015-09-24 Thread Attila Krasznahorkay
Dear All, I'd like to ask for some advice about the following issue. We're migrating a very big project (millions of lines of code...) from a custom build manager to CMake. The software is put together from separate "packages" that are all developed by a different set of people. Our nightly