[CMake] CMAKE_INCLUDE_CURRENT_DIR on a function

2016-10-24 Thread Tiago Macarios
Hi, Does CMAKE_INCLUDE_CURRENT_DIR need to be set outside of a function? I have a function where I define an executable "add_executable". This executable uses moc'ed Qt clasees, so I need to set CMAKE_INCLUDE_CURRENT_DIR. It seems like I have to set it from the top level script calling the functi

Re: [CMake] CMAKE_INCLUDE_CURRENT_DIR on a function

2016-10-24 Thread Craig Scott
function() introduces a new scope, so if you want changes you make to variables inside the function to be visible outside the function, you need to use set(... PARENT_SCOPE). Alternatively, a macro() does not introduce a new scope, so replacing your function() with a macro() may also yield the beha

Re: [CMake] CMAKE_INCLUDE_CURRENT_DIR on a function

2016-10-24 Thread Tiago Macarios
Hi Craig, Maybe my problem description was lacking. Below is the function I have. Both CMAKE_INCLUDE_CURRENT_DIR and the target are defined on the same function scope, but this does not seem to work. I need to define CMAKE_INCLUDE_CURRENT_DIR on the parent CMakeLists file. function(AddTest) s

Re: [CMake] CMAKE_INCLUDE_CURRENT_DIR on a function

2016-10-24 Thread Craig Scott
Are you sure what you want isn't to specify INTERFACE header directories on whatever is being passed in as the ${TEST_LIBRARIES} libraries? If the requirement to have the parent directory's source/binary dirs added to the header search path is coming from those instead of the test's own executable,

Re: [CMake] Prevent ExternalProject from updating git submodules

2016-10-24 Thread Tim Rae
Hi all, I'm using ExternalProject_Add to add the popular C++ library range-v3 to one of our projects. However, since the build server only has local intranet access, and therefore can't access the main github repository, we have put a clone of that repo on our local gitlab: ExternalProject_A

Re: [CMake] Prevent ExternalProject from updating git submodules

2016-10-24 Thread Hendrik Sattler
Hi, you can tell git where your copy of tree remote url is. This is site-specific and does not change the repository: git config remote."$origirl".url "$newurl" HS Am 25. Oktober 2016 03:52:12 MESZ, schrieb Tim Rae : >Hi all, > >I'm using ExternalProject_Add to add the popular C++ library rang

Re: [CMake] Prevent ExternalProject from updating git submodules

2016-10-24 Thread Timothy Rae
Thanks for the tip, but I'd rather it didn't fetch the documentation submodule at all, as this unnecessarily slows down the build. On Tue, Oct 25, 2016 at 12:29 PM, Hendrik Sattler wrote: > Hi, > > you can tell git where your copy of tree remote url is. This is > site-specific and does not chang

Re: [CMake] CMAKE_INCLUDE_CURRENT_DIR on a function

2016-10-24 Thread Petr Kmoch
Hi Tiago. Yes, Craig's original comment applies. Targets do not have scope, variables do. Because you're in a function, you'd need to set the variable using PARENT_SCOPE to have it apply outside the function: function(AddTest) #... set(CMAKE_INCLUDE_CURRENT_DIR ON PARENT_SCOPE) #... endfunc