print path variables within submodules?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

print path variables within submodules?

Carlton banks
I am using submodule cmake, in which the relative paths becomes a bit more confusing that I would have hoped.

Is there a way to print the path like ${source_dir} and so on within the CMAKElist, so I can keep track of the paths defined?

I tried `message(${source_dir})` but the output is empty


--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: print path variables within submodules?

Nicholas Devenish
Hi Carlton,

On Sun, Oct 29, 2017 at 12:02 PM, Carlton Banks <[hidden email]> wrote:
Is there a way to print the path like ${source_dir} and so on within the CMAKElist, so I can keep track of the paths defined?
 
I found understanding exactly what you are asking for a little unclear, but possibly you are looking for CMAKE_CURRENT_SOURCE_DIR - the path to the source directory currently being processed? This should work to display it:

message(${CMAKE_CURRENT_SOURCE_DIR})

the problem probably being that cmake doesn't usually define a variable named "source_dir" - unless you've defined one yourself.

Otherwise there's a list of everything CMake defines at https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html

Nick

--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: print path variables within submodules?

Gonzalo Garramuño
In reply to this post by Carlton banks


El 29/10/17 a las 09:02, Carlton Banks escribió:
> I am using submodule cmake, in which the relative paths becomes a bit more confusing that I would have hoped.
>
> Is there a way to print the path like ${source_dir} and so on within the CMAKElist, so I can keep track of the paths defined?
>
> I tried `message(${source_dir})` but the output is empty
>

Try message( ${CMAKE_CURRENT_SOURCE_DIR} )

--
Gonzalo Garramuño

--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: print path variables within submodules?

Carlton banks

> Den 30. okt. 2017 kl. 16.53 skrev Gonzalo Garramuño <[hidden email]>:
>
>
>
> El 29/10/17 a las 09:02, Carlton Banks escribió:
>> I am using submodule cmake, in which the relative paths becomes a bit more confusing that I would have hoped.
>>
>> Is there a way to print the path like ${source_dir} and so on within the CMAKElist, so I can keep track of the paths defined?
>>
>> I tried `message(${source_dir})` but the output is empty
>>
>
> Try message( ${CMAKE_CURRENT_SOURCE_DIR} )
That just output an empty message...
>
> --
> Gonzalo Garramuño
>

--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: print path variables within submodules?

Gonzalo Garramuño


El 30/10/17 a las 14:59, Carlton Banks escribió:

>> Den 30. okt. 2017 kl. 16.53 skrev Gonzalo Garramuño <[hidden email]>:
>>
>>
>>
>> El 29/10/17 a las 09:02, Carlton Banks escribió:
>>> I am using submodule cmake, in which the relative paths becomes a bit more confusing that I would have hoped.
>>>
>>> Is there a way to print the path like ${source_dir} and so on within the CMAKElist, so I can keep track of the paths defined?
>>>
>>> I tried `message(${source_dir})` but the output is empty
>>>
>> Try message( ${CMAKE_CURRENT_SOURCE_DIR} )
> That just output an empty message...
>
This works for me.  Try this simple CMakeLists.txt file:

set( PROJECT tryme )
message( ${CMAKE_CURRENT_SOURCE_DIR} )

--
Gonzalo Garramuño

--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: print path variables within submodules?

Carlton banks
Hmm.. That worked.. I don’t know sometimes it does  not work.. weird..


> Den 30. okt. 2017 kl. 22.25 skrev Gonzalo Garramuño <[hidden email]>:
>
>
>
> El 30/10/17 a las 14:59, Carlton Banks escribió:
>>> Den 30. okt. 2017 kl. 16.53 skrev Gonzalo Garramuño <[hidden email]>:
>>>
>>>
>>>
>>> El 29/10/17 a las 09:02, Carlton Banks escribió:
>>>> I am using submodule cmake, in which the relative paths becomes a bit more confusing that I would have hoped.
>>>>
>>>> Is there a way to print the path like ${source_dir} and so on within the CMAKElist, so I can keep track of the paths defined?
>>>>
>>>> I tried `message(${source_dir})` but the output is empty
>>>>
>>> Try message( ${CMAKE_CURRENT_SOURCE_DIR} )
>> That just output an empty message...
>>
> This works for me.  Try this simple CMakeLists.txt file:
>
> set( PROJECT tryme )
> message( ${CMAKE_CURRENT_SOURCE_DIR} )
>
> --
> Gonzalo Garramuño
>

--

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:
http://public.kitware.com/mailman/listinfo/cmake