Re: [CMake] Relaying all command line arguments from SuperBuild to ExternalProject_Add

2018-01-31 Thread Saad Khattak
Thank you Don, that was it. Querying and storing the args before a call to
'project' and your loop and your conditional were the key.

On Wed, Jan 31, 2018 at 10:14 PM Don Hinton  wrote:

> Hi Saad:
>
> On Wed, Jan 31, 2018 at 6:47 PM, Saad Khattak 
> wrote:
>
>> Thanks J. I could use that to add preprocessor definitions.
>>
>> However, my question was how I could forward 'all' the command line
>> options that the user uses to generate the SuperBuild project. Suppose I
>> somehow managed to capture all the command line arguments which can include
>> variables specific to CMake and/or projects (i.e. nothing to do with
>> preprocessor definitions) in a variable called CL_CMAKE_ARGS.
>>
>
> The example you are using is close, but not quite correct.
>
> You need to harvest the comandline arguments before calling `project()`,
> just note that it won't work if CMakeCache.txt already exists.
>
> Some CMAKE variables will still have HELPSTRINGS, even if passed via the
> command line, and users can also set a random or blank HELPSTRING if they
> use a cache file.  To overcome these issues, just harvest all cache
> variables and exclude the invariant ones, e.g., CMAKE_COMMAND, etc., e.g.:
>
> $ cat ../CMakeLists.txt
> cmake_minimum_required(VERSION 3.5)
>
> message(STATUS "*** All CACHE_VARIABLES ***")
> get_cmake_property(vars CACHE_VARIABLES)
> foreach(var ${vars})
>   get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING)
> message("${var} = [${${var}}]  --  ${currentHelpString}")
> endforeach()
>
> project(xxx)
> message(STATUS "project() called.")
>
> message(STATUS "*** Only CACHE_VARIABLES with HELPSTRING empty or matching
> \"No help,...\" ***")
> get_cmake_property(vars CACHE_VARIABLES)
> foreach(var ${vars})
>   get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING)
> if("${currentHelpString}" MATCHES "No help, variable specified on
> the command line." OR "${currentHelpString}" STREQUAL "")
> message("${var} = [${${var}}]  --  ${currentHelpString}")
> endif()
> endforeach()
>
> $ rm -rf * && cmake -DFOO=1 -DCMAKE_BUILD_TYPE=Release -GNinja ..
> -- *** All CACHE_VARIABLES ***
> CMAKE_BUILD_TYPE = [Release]  --  No help, variable specified on the
> command line.
> CMAKE_COMMAND = [/opt/local/bin/cmake]  --  Path to CMake executable.
> CMAKE_CPACK_COMMAND = [/opt/local/bin/cpack]  --  Path to cpack program
> executable.
> CMAKE_CTEST_COMMAND = [/opt/local/bin/ctest]  --  Path to ctest program
> executable.
> CMAKE_EXTRA_GENERATOR = []  --  Name of external makefile project
> generator.
> CMAKE_GENERATOR = [Ninja]  --  Name of generator.
> CMAKE_GENERATOR_PLATFORM = []  --  Name of generator platform.
> CMAKE_GENERATOR_TOOLSET = []  --  Name of generator toolset.
> CMAKE_HOME_DIRECTORY = [/Users/dhinton/cmake_test]  --  Source directory
> with the top level CMakeLists.txt file for this project
> CMAKE_ROOT = [/opt/local/share/cmake-3.10]  --  Path to CMake installation.
> FOO = [1]  --  No help, variable specified on the command line.
> -- The C compiler identification is AppleClang 9.0.0.939
> -- The CXX compiler identification is AppleClang 9.0.0.939
> -- Check for working C compiler:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
> -- Check for working C compiler:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
> -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Check for working CXX compiler:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
> -- Check for working CXX compiler:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
> -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- project() called.
> -- *** Only CACHE_VARIABLES with HELPSTRING empty or matching "No
> help,..." ***
> FOO = [1]  --  No help, variable specified on the command line.
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /Users/dhinton/cmake_test/build
>
> hth...
> don
>
>
>> If I do message(${CL_CMAKE_ARGS}) I get:
>>
>>  -DMY_OPTION_ONE=ON -DMY_OPTION_TWO=OFF -DSOME_VAR_1="Foo"
>>
>> Now, when I try something like this:
>>
>> ExternalProject_Add(target
>> ...
>> CMAKE_ARGS ${CL_CMAKE_ARGS}
>> ...
>> )
>>
>> One would expect CL_CMAKE_ARGS to be expanded and the arguments passed to
>> the ExternalProject_Add function, but that is not the case. I also tried:
>>
>> ExternalProject_Add(target
>> ...
>> CMAKE_ARGS "${CL_CMAKE_ARGS}"
>> ...
>> )
>>
>> Neither works. It seems like a bug in CMake but I wanted to confirm that
>> I am not missing something.
>>
>> On Wed, Jan 31, 2018 at 3:27 PM J Decker  wrote:
>>
>>>
>>> (platfrom de

Re: [CMake] Relaying all command line arguments from SuperBuild to ExternalProject_Add

2018-01-31 Thread Don Hinton
Hi Saad:

On Wed, Jan 31, 2018 at 6:47 PM, Saad Khattak  wrote:

> Thanks J. I could use that to add preprocessor definitions.
>
> However, my question was how I could forward 'all' the command line
> options that the user uses to generate the SuperBuild project. Suppose I
> somehow managed to capture all the command line arguments which can include
> variables specific to CMake and/or projects (i.e. nothing to do with
> preprocessor definitions) in a variable called CL_CMAKE_ARGS.
>

The example you are using is close, but not quite correct.

You need to harvest the comandline arguments before calling `project()`,
just note that it won't work if CMakeCache.txt already exists.

Some CMAKE variables will still have HELPSTRINGS, even if passed via the
command line, and users can also set a random or blank HELPSTRING if they
use a cache file.  To overcome these issues, just harvest all cache
variables and exclude the invariant ones, e.g., CMAKE_COMMAND, etc., e.g.:

$ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 3.5)

message(STATUS "*** All CACHE_VARIABLES ***")
get_cmake_property(vars CACHE_VARIABLES)
foreach(var ${vars})
  get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING)
message("${var} = [${${var}}]  --  ${currentHelpString}")
endforeach()

project(xxx)
message(STATUS "project() called.")

message(STATUS "*** Only CACHE_VARIABLES with HELPSTRING empty or matching
\"No help,...\" ***")
get_cmake_property(vars CACHE_VARIABLES)
foreach(var ${vars})
  get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING)
if("${currentHelpString}" MATCHES "No help, variable specified on
the command line." OR "${currentHelpString}" STREQUAL "")
message("${var} = [${${var}}]  --  ${currentHelpString}")
endif()
endforeach()

$ rm -rf * && cmake -DFOO=1 -DCMAKE_BUILD_TYPE=Release -GNinja ..
-- *** All CACHE_VARIABLES ***
CMAKE_BUILD_TYPE = [Release]  --  No help, variable specified on the
command line.
CMAKE_COMMAND = [/opt/local/bin/cmake]  --  Path to CMake executable.
CMAKE_CPACK_COMMAND = [/opt/local/bin/cpack]  --  Path to cpack program
executable.
CMAKE_CTEST_COMMAND = [/opt/local/bin/ctest]  --  Path to ctest program
executable.
CMAKE_EXTRA_GENERATOR = []  --  Name of external makefile project generator.
CMAKE_GENERATOR = [Ninja]  --  Name of generator.
CMAKE_GENERATOR_PLATFORM = []  --  Name of generator platform.
CMAKE_GENERATOR_TOOLSET = []  --  Name of generator toolset.
CMAKE_HOME_DIRECTORY = [/Users/dhinton/cmake_test]  --  Source directory
with the top level CMakeLists.txt file for this project
CMAKE_ROOT = [/opt/local/share/cmake-3.10]  --  Path to CMake installation.
FOO = [1]  --  No help, variable specified on the command line.
-- The C compiler identification is AppleClang 9.0.0.939
-- The CXX compiler identification is AppleClang 9.0.0.939
-- Check for working C compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- project() called.
-- *** Only CACHE_VARIABLES with HELPSTRING empty or matching "No help,..."
***
FOO = [1]  --  No help, variable specified on the command line.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/dhinton/cmake_test/build

hth...
don


> If I do message(${CL_CMAKE_ARGS}) I get:
>
>  -DMY_OPTION_ONE=ON -DMY_OPTION_TWO=OFF -DSOME_VAR_1="Foo"
>
> Now, when I try something like this:
>
> ExternalProject_Add(target
> ...
> CMAKE_ARGS ${CL_CMAKE_ARGS}
> ...
> )
>
> One would expect CL_CMAKE_ARGS to be expanded and the arguments passed to
> the ExternalProject_Add function, but that is not the case. I also tried:
>
> ExternalProject_Add(target
> ...
> CMAKE_ARGS "${CL_CMAKE_ARGS}"
> ...
> )
>
> Neither works. It seems like a bug in CMake but I wanted to confirm that I
> am not missing something.
>
> On Wed, Jan 31, 2018 at 3:27 PM J Decker  wrote:
>
>>
>> (platfrom defines is a variable suitable for like ADD_DEFINITIONS(
>> ${PLATFORM_DEFINES} )
>>
>>
>>   string( REPLACE ";" " " PLATFORM_DEFINES_ARG "${PLATFORM_DEFINES}" )
>>   ExternalProject_Add( target
>> 
>> CMAKE_ARGS -DPLATFORM_DEFINES=${PLATFORM_DEFINES_ARG}
>> ..
>>  )
>>
>>
>> and in the target cmakelists to use the argument
>>
>>
>> STRING( REPLACE " " ";" PLATFORM_DEFINES $

Re: [CMake] Relaying all command line arguments from SuperBuild to ExternalProject_Add

2018-01-31 Thread Saad Khattak
Thanks J. I could use that to add preprocessor definitions.

However, my question was how I could forward 'all' the command line options
that the user uses to generate the SuperBuild project. Suppose I somehow
managed to capture all the command line arguments which can include
variables specific to CMake and/or projects (i.e. nothing to do with
preprocessor definitions) in a variable called CL_CMAKE_ARGS.

If I do message(${CL_CMAKE_ARGS}) I get:

 -DMY_OPTION_ONE=ON -DMY_OPTION_TWO=OFF -DSOME_VAR_1="Foo"

Now, when I try something like this:

ExternalProject_Add(target
...
CMAKE_ARGS ${CL_CMAKE_ARGS}
...
)

One would expect CL_CMAKE_ARGS to be expanded and the arguments passed to
the ExternalProject_Add function, but that is not the case. I also tried:

ExternalProject_Add(target
...
CMAKE_ARGS "${CL_CMAKE_ARGS}"
...
)

Neither works. It seems like a bug in CMake but I wanted to confirm that I
am not missing something.

On Wed, Jan 31, 2018 at 3:27 PM J Decker  wrote:

>
> (platfrom defines is a variable suitable for like ADD_DEFINITIONS(
> ${PLATFORM_DEFINES} )
>
>
>   string( REPLACE ";" " " PLATFORM_DEFINES_ARG "${PLATFORM_DEFINES}" )
>   ExternalProject_Add( target
> 
> CMAKE_ARGS -DPLATFORM_DEFINES=${PLATFORM_DEFINES_ARG}
> ..
>  )
>
>
> and in the target cmakelists to use the argument
>
>
> STRING( REPLACE " " ";" PLATFORM_DEFINES ${PLATFORM_DEFINES} )
>
> add_definitions( ${PLATFORM_DEFINES} )
>
>
>
> On Wed, Jan 31, 2018 at 9:36 AM, Saad Khattak 
> wrote:
>
>> I have the following setup:
>> Superbuild
>>- ExternalProject_Add(a...)
>>- ExternalProject_Add(b...)
>>- ExternalProject_Add(c...)
>>- ExternalProject_Add(d...)
>>
>> The SuperBuild is built from command line with some options e.g.
>> -DMY_OPTION=TRUE. I would like all these options to be passed to each of
>> the ExternalProject_Add CMAKE_ARGS.
>>
>> I tried to capture the arguments using the solution posted here:
>> https://stackoverflow.com/a/10218582/368599
>>
>> The arguments are captured properly (i.e. I printed them out to make sure
>> they are correct) but relaying them to ExternalProject_Add appears to be
>> problematic. I tried the following ways to forward the arguments (as
>> outlined in the stackoverflow solution):
>>
>> ExternalProject_Add(...
>>   CMAKE_ARGS ${CMAKE_ARGS}
>>   )
>>
>> ExternalProject_Add(...
>>   CMAKE_ARGS "${CMAKE_ARGS}" # quotes
>>   )
>>
>> ExternalProject_Add(...
>>   CMAKE_ARGS "${MY_CMAKE_ARGS}" # changed the variable name in case it
>> conflicts
>>   )
>>
>> None of that seems to work. CMake appears to ignore the commands
>> forwarded.
>>
>> Is there something I am missing?
>>
>> Thanks,
>> Saad
>>
>>
>> --
>>
>> 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] (no subject)

2018-01-31 Thread Kris Thielemans
You have to specify the full path to the locally installed cmake, or add its 
location to your PATH environment variables (before anything else)

 

ATB

Kris

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of kartikay gupta
Sent: 31 January 2018 17:30
To: cmake@cmake.org
Subject: [CMake] (no subject)

 

Hi

 

I want to install cmake 3.10 to my institute high performace computing without 
root access, in local directory. I am able to install it, but still when I call 
the command 'cmake .. -DUSE_CUDA=ON' , it asks to upgrade cmake to atleast 3.5. 

What should be done to load cmake 3.10?

 

 

-- 

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] Relaying all command line arguments from SuperBuild to ExternalProject_Add

2018-01-31 Thread J Decker
(platfrom defines is a variable suitable for like ADD_DEFINITIONS(
${PLATFORM_DEFINES} )


  string( REPLACE ";" " " PLATFORM_DEFINES_ARG "${PLATFORM_DEFINES}" )
  ExternalProject_Add( target

CMAKE_ARGS -DPLATFORM_DEFINES=${PLATFORM_DEFINES_ARG}
..
 )


and in the target cmakelists to use the argument


STRING( REPLACE " " ";" PLATFORM_DEFINES ${PLATFORM_DEFINES} )

add_definitions( ${PLATFORM_DEFINES} )



On Wed, Jan 31, 2018 at 9:36 AM, Saad Khattak  wrote:

> I have the following setup:
> Superbuild
>- ExternalProject_Add(a...)
>- ExternalProject_Add(b...)
>- ExternalProject_Add(c...)
>- ExternalProject_Add(d...)
>
> The SuperBuild is built from command line with some options e.g.
> -DMY_OPTION=TRUE. I would like all these options to be passed to each of
> the ExternalProject_Add CMAKE_ARGS.
>
> I tried to capture the arguments using the solution posted here:
> https://stackoverflow.com/a/10218582/368599
>
> The arguments are captured properly (i.e. I printed them out to make sure
> they are correct) but relaying them to ExternalProject_Add appears to be
> problematic. I tried the following ways to forward the arguments (as
> outlined in the stackoverflow solution):
>
> ExternalProject_Add(...
>   CMAKE_ARGS ${CMAKE_ARGS}
>   )
>
> ExternalProject_Add(...
>   CMAKE_ARGS "${CMAKE_ARGS}" # quotes
>   )
>
> ExternalProject_Add(...
>   CMAKE_ARGS "${MY_CMAKE_ARGS}" # changed the variable name in case it
> conflicts
>   )
>
> None of that seems to work. CMake appears to ignore the commands forwarded.
>
> Is there something I am missing?
>
> Thanks,
> Saad
>
>
> --
>
> 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] (no subject)

2018-01-31 Thread Marco Schuler
In your cmakelists.txt search for cmake_minumum_required and replace the
version with the version of cmake that you have installed. You might be
lucky and your program compiles.

P.S.: Please do not leave empty the subject of your e-mail...

Am 31.01.2018 18:29 schrieb "kartikay gupta" :

> Hi
>
> I want to install cmake 3.10 to my institute high performace computing
> without root access, in local directory. I am able to install it, but still
> when I call the command 'cmake .. -DUSE_CUDA=ON' , it asks to upgrade cmake
> to atleast 3.5.
> What should be done to load cmake 3.10?
>
>
>
> --
>
> 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] (no subject)

2018-01-31 Thread kartikay gupta
yes, I got it. Thanks.

On Wed, Jan 31, 2018 at 11:16 PM, Eric Noulard 
wrote:

>
>
> 2018-01-31 18:29 GMT+01:00 kartikay gupta :
>
>> Hi
>>
>> I want to install cmake 3.10 to my institute high performace computing
>> without root access, in local directory. I am able to install it, but still
>> when I call the command 'cmake .. -DUSE_CUDA=ON' , it asks to upgrade cmake
>> to atleast 3.5.
>> What should be done to load cmake 3.10?
>>
>
> You should use the complete path to your locally installed cmake (or
> change your path).
>
> i.e. something like:
>
> /home/kartikay/local/cmake/bin/cmake .. -DUSE_CUDA=ON
>
>
> --
> Eric
>
-- 

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] (no subject)

2018-01-31 Thread Eric Noulard
2018-01-31 18:29 GMT+01:00 kartikay gupta :

> Hi
>
> I want to install cmake 3.10 to my institute high performace computing
> without root access, in local directory. I am able to install it, but still
> when I call the command 'cmake .. -DUSE_CUDA=ON' , it asks to upgrade cmake
> to atleast 3.5.
> What should be done to load cmake 3.10?
>

You should use the complete path to your locally installed cmake (or change
your path).

i.e. something like:

/home/kartikay/local/cmake/bin/cmake .. -DUSE_CUDA=ON


-- 
Eric
-- 

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] Relaying all command line arguments from SuperBuild to ExternalProject_Add

2018-01-31 Thread Saad Khattak
I have the following setup:
Superbuild
   - ExternalProject_Add(a...)
   - ExternalProject_Add(b...)
   - ExternalProject_Add(c...)
   - ExternalProject_Add(d...)

The SuperBuild is built from command line with some options e.g.
-DMY_OPTION=TRUE. I would like all these options to be passed to each of
the ExternalProject_Add CMAKE_ARGS.

I tried to capture the arguments using the solution posted here:
https://stackoverflow.com/a/10218582/368599

The arguments are captured properly (i.e. I printed them out to make sure
they are correct) but relaying them to ExternalProject_Add appears to be
problematic. I tried the following ways to forward the arguments (as
outlined in the stackoverflow solution):

ExternalProject_Add(...
  CMAKE_ARGS ${CMAKE_ARGS}
  )

ExternalProject_Add(...
  CMAKE_ARGS "${CMAKE_ARGS}" # quotes
  )

ExternalProject_Add(...
  CMAKE_ARGS "${MY_CMAKE_ARGS}" # changed the variable name in case it
conflicts
  )

None of that seems to work. CMake appears to ignore the commands forwarded.

Is there something I am missing?

Thanks,
Saad
-- 

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] (no subject)

2018-01-31 Thread kartikay gupta
Hi

I want to install cmake 3.10 to my institute high performace computing
without root access, in local directory. I am able to install it, but still
when I call the command 'cmake .. -DUSE_CUDA=ON' , it asks to upgrade cmake
to atleast 3.5.
What should be done to load cmake 3.10?
-- 

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] Wrong MSVC with ExternalProject_Add

2018-01-31 Thread Gaƫl de Chalendar
Hi,

I encounter a problem using cmake (3.9 an 3.10) with Visual c++ 2015 under 
Windows 10. 

My build works with the "Visual Studio 14 2015 Win64" generator but I fail to 
build using the Ninja generator.

I first solved a first step with help from stackoverflow and a blog post:
https://stackoverflow.com/questions/47904633/how-to-use-together-buildbot-cmake-ninja-and-visual-studio-c-compiler

Now, the initial cmake step runs well:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_IGNORE_PATH=C:/Strawberry/c/
bin -DCMAKE_INSTALL_PREFIX=C:\disk\amose-buildbot-worker\lima-master-
windows-10\Dist\master\Release -DWITH_ARCH=ON -DLIMA_RESOURCES=build -
DLIMA_VERSION_RELEASE=master -DSHORTEN_POR_CORPUS_FOR_SVMLEARN=TRUE C:\disk
\amose-buildbot-worker\lima-master-windows-10\Sources
 in dir Z:\b (timeout 1200 secs)
 watching logfiles {}
 argv: [b'cmake', b'-G', b'Ninja', b'-DCMAKE_BUILD_TYPE=Release', b'-
DCMAKE_IGNORE_PATH=C:/Strawberry/c/bin', b'-DCMAKE_INSTALL_PREFIX=C:\\disk\
\amose-buildbot-worker\\lima-master-windows-10\\Dist\\master\\Release', b'-
DWITH_ARCH=ON', b'-DLIMA_RESOURCES=build', b'-DLIMA_VERSION_RELEASE=master', 
b'-DSHORTEN_POR_CORPUS_FOR_SVMLEARN=TRUE', b'C:\\disk\\amose-buildbot-worker\
\lima-master-windows-10\\Sources']
 environment:

-- The C compiler identification is MSVC 19.0.24210.0
-- The CXX compiler identification is MSVC 19.0.24210.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio 14.0/VC/bin/amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio 14.0/VC/bin/amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual 
Studio 14.0/VC/bin/amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual 
Studio 14.0/VC/bin/amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
SHORTEN_POR_CORPUS_FOR_SVMLEARN=TRUE
WITH_ASAN=OFF
WITH_ARCH=ON
Windows flags
PERL5LIB=C:/disk/amose-buildbot-worker/lima-master-windows-10/Sources/
lima_pelf/evalPosTagging/SVM/SVMTool-1.3.1/lib:
PATH=C:/disk/amose-buildbot-worker/lima-master-windows-10/Sources/lima_pelf/
evalPosTagging/SVM/SVMTool-1.3.1/bin:C:/Users/buildbot/Projets/externals
\bin;C:/Users/buildbot/Projets/externals\lib;C:\disk\amose-buildbot-worker
\lima-master-windows-10\Dist\master\Release\bin;C:\disk\amose-buildbot-worker
\lima-master-windows-10\Dist\master\Release\lib;C:\Program Files (x86)\MSBuild
\14.0\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN
\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows
\Microsoft.NET\Framework64\;C:\Program Files (x86)\Windows Kits\8.1\bin\x64;C:
\Program Files (x86)\Windows Kits\8.1\bin\x86;c:\d\bin;c:\d\share\apps\lima
\scripts;C:\Qt\Qt5.6.3\5.6.3\msvc2015_64\bin;%BOOST_LIBRARYDIR%;c:\msys64\usr
\bin;C:\ProgramData\chocolatey\lib\msys2;C:\tools\msys64;C:\tools\msys64\usr
\bin;C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs
\Microsoft.UniversalCRT.Debug\10.0.10240.0\Redist\Debug\x86;C:
\Python36\Scripts\;C:\Python36\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\ProgramData
\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits
\8.1\Windows Performance Toolkit\;C:\local\boost_1_58_0\lib64-msvc-12.0;C:
\Program Files\CMake\bin;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:
\Strawberry\perl\bin;C:\Program Files\Java\jdk1.8.0_162\bin;C:\Users\buildbot
\AppData\Local\Microsoft\WindowsApps;c:\Qt\Qt5.6.3\5.6.3\msvc2015_64;;c:
\python36\lib\site-packages\pypiwin32_system32
Found Qt5 5.6.3
Adding module Core
Adding module Core
-- Configuring done
-- Generating done
-- Build files have been written to: Z:/b
program finished with exit code 0
elapsedTime=35.421545

But wen the build step runs, the configuration of the first ExternalProject_Add 
fails:

cmake --build . --config Release
 in dir Z:\b (timeout 3600 secs)
 watching logfiles {}
 argv: [b'cmake', b'--build', b'.', b'--config', b'Release']
 environment:

 using PTY: False
[1/55] Creating directories for 'lima_common'
[1/55] No download step for 'lima_common'
[2/55] No update step for 'lima_common'
[3/55] No patch step for 'lima_common'
[4/55] Performing configure step for 'lima_common'
-- The C compiler identification is MSVC 19.0.24210.0
-- The CXX compiler identification is MSVC
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio 14.0/VC/bin/amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio 14.0/VC/bin/amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual 
Studio 14.0/VC/bin/amd64/cl.exe
CMake Error at C:/Program F

[CMake] Core-dumping CTest tests that fail

2018-01-31 Thread Rainer Poisel
Hello,

I have a few CTest tests that fail (e. g. SEGFAULT) or timeout on
Linux from time to time. The tests are performed in a Continuous
Integration (CI) environment and I would like to simplify the analysis
in case a test fails.

Is there a way to make failing CTest tests to dump their core? In my
CI I would then invoke gdb automatically to print a call-stack of all
involved threads.

Thanks and regards,
  Rainer
-- 

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] How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ?

2018-01-31 Thread Franck Houssen
How to get RPATH option (-Wl,-rpath,/path/to/local/lib) ? 

I would like to create a *.pc/cmake file for users to find a library I provide. 
As there is possibly a LOT of dependencies (libraries) I may not even be able 
to list, the most simple way to do that is to use RPATH. I know that for gcc, 
RPATH is set with "-Wl,-rpath". But what about others compilers (pgi, icc) ? 
This option could not be the same. 

Is it possible to "grab" the correct RPATH option (-Wl,-rpath) according to the 
compiler ? Something like a CMAKE_RPATH_OPTIONS to substitute in a 
*.pc/cmake.in template file ? (to create a *.pc/cmake file in the install 
directory using configure_file) 

Franck 
-- 

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] [Digital Signature Failure] Re: Hard to do if in Macro

2018-01-31 Thread Dvir Yitzchaki
You can add PARENT_SCOPE to set command to set the value on the calling code.

Regards,
Dvir

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of J Decker
Sent: Tuesday, January 30, 2018 18:07
To: Petr Kmoch 
Cc: CMake Mail List 
Subject: [Digital Signature Failure] Re: [CMake] Hard to do if in Macro

Okay... but then with function I can't set external variables; but if( 
__ANDROID__ ) works.

`result` never changes.

---

set( __ANDROID__ 1 )

function( test __ANDROID__ RETVAL )

  if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
set( ${RETVAL} ${${RETVAL}} qwer2 )
message( "Included. " )
  endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")

  if( __ANDROID__ )
set( ${RETVAL} ${${RETVAL}} asdf )
message( "ALWAYS Included ${__ANDROID__}" )
  endif( __ANDROID__ )

endfunction( test )


set( result "default" )

test( __ANDROID__ "result" )
message( "REsult:${result}" )

test( ${__ANDROID__} "result" )
message( "REsult:${result}" )

test( OFF  "result")
message( "REsult:${result}" )

---




On Tue, Jan 30, 2018 at 12:35 AM, Petr Kmoch 
mailto:petr.km...@gmail.com>> wrote:
Macros aren't functions, and macro parameters aren't CMake variables. Expanding 
a macro parameter is effectively *textual* substitution, whereas dereferencing 
a CMake variable is a semantic one.
In other words, inside your macro, the text __ANDROID__ (when not expanded) 
never refers to the macro parameter. Macro parameters "don't exist" outside of 
expansion context. The `if(__ANDROID__)` bit therefore always refers to the 
variable __ANDROID__, never to the macro parameter __ANDROID__.
You still don't have to spell out the conditional as explicitly as you're doing 
it now, but you have to expand the parameter:
macro(test __ANDROID__)
  if(${__ANDROID__})
message( "Included. " )
  endif()
endmacro()
This is what the evaluation will look like based on how you call it:
test(__ANDROID__)   -> if(__ANDROID__) -> refers to the variable
set(__ANDROID__ 1)
test(${__ANDROID__})   -> if(1)
set(__ANDROID__ 0)
test(${__ANDROID__})   -> if(0)
test(OFF)   -> if(OFF)
CMake macros have a lot of specific and potentially weird/counterintuitive 
behaviour. In general, you should always write your commands as functions and 
only resort to macros if you explicitly need their specific behaviour.
Petr



On 30 January 2018 at 09:11, J Decker 
mailto:d3c...@gmail.com>> wrote:
Why do I have to do

if( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")
endif( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")

in a macro like...
--

set( __ANDROID__ 1 )

macro( test __ANDROID__ )

  if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
message( "Included. " )
  endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")

  if( __ANDROID__ )
message( "ALWAYS Included ${__ANDROID__}" )
  endif( __ANDROID__ )

endmacro( test )

test( __ANDROID__ )
test( ${__ANDROID__} )
test( OFF )

--
Output

Included.
ALWAYS Included __ANDROID__
Included.
ALWAYS Included 1
ALWAYS Included OFF

--

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] Hard to do if in Macro

2018-01-31 Thread Petr Kmoch
When returning values from a function, you have to use the PARENT_SCOPE
argument of set():

function( test __ANDROID__ RETVAL )

  if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
set( ${RETVAL} ${${RETVAL}} qwer2 PASRENT_SCOPE)
message( "Included. " )
  endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")

  if( __ANDROID__ )
set( ${RETVAL} ${${RETVAL}} asdf PARENT_SCOPE)
message( "ALWAYS Included ${__ANDROID__}" )
  endif( __ANDROID__ )

endfunction( test )

Petr


On 30 January 2018 at 17:07, J Decker  wrote:

> Okay... but then with function I can't set external variables; but if(
> __ANDROID__ ) works.
>
> `result` never changes.
>
> ---
>
> set( __ANDROID__ 1 )
>
> function( test __ANDROID__ RETVAL )
>
>   if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
> set( ${RETVAL} ${${RETVAL}} qwer2 )
> message( "Included. " )
>   endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
>
>   if( __ANDROID__ )
> set( ${RETVAL} ${${RETVAL}} asdf )
> message( "ALWAYS Included ${__ANDROID__}" )
>   endif( __ANDROID__ )
>
> endfunction( test )
>
>
> set( result "default" )
>
> test( __ANDROID__ "result" )
> message( "REsult:${result}" )
>
> test( ${__ANDROID__} "result" )
> message( "REsult:${result}" )
>
> test( OFF  "result")
> message( "REsult:${result}" )
>
> ---
>
>
>
>
> On Tue, Jan 30, 2018 at 12:35 AM, Petr Kmoch  wrote:
>
>> Macros aren't functions, and macro parameters aren't CMake variables.
>> Expanding a macro parameter is effectively *textual* substitution, whereas
>> dereferencing a CMake variable is a semantic one.
>>
>> In other words, inside your macro, the text __ANDROID__ (when not
>> expanded) never refers to the macro parameter. Macro parameters "don't
>> exist" outside of expansion context. The `if(__ANDROID__)` bit therefore
>> always refers to the variable __ANDROID__, never to the macro parameter
>> __ANDROID__.
>>
>> You still don't have to spell out the conditional as explicitly as you're
>> doing it now, but you have to expand the parameter:
>>
>> macro(test __ANDROID__)
>>   if(${__ANDROID__})
>> message( "Included. " )
>>   endif()
>> endmacro()
>>
>> This is what the evaluation will look like based on how you call it:
>>
>> test(__ANDROID__)   -> if(__ANDROID__) -> refers to the variable
>> set(__ANDROID__ 1)
>> test(${__ANDROID__})   -> if(1)
>> set(__ANDROID__ 0)
>> test(${__ANDROID__})   -> if(0)
>> test(OFF)   -> if(OFF)
>>
>> CMake macros have a lot of specific and potentially
>> weird/counterintuitive behaviour. In general, you should always write your
>> commands as functions and only resort to macros if you explicitly need
>> their specific behaviour.
>>
>> Petr
>>
>>
>>
>> On 30 January 2018 at 09:11, J Decker  wrote:
>>
>>> Why do I have to do
>>>
>>> if( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")
>>> endif( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")
>>>
>>> in a macro like...
>>> --
>>>
>>> set( __ANDROID__ 1 )
>>>
>>> macro( test __ANDROID__ )
>>>
>>>   if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
>>> message( "Included. " )
>>>   endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
>>>
>>>   if( __ANDROID__ )
>>> message( "ALWAYS Included ${__ANDROID__}" )
>>>   endif( __ANDROID__ )
>>>
>>> endmacro( test )
>>>
>>> test( __ANDROID__ )
>>> test( ${__ANDROID__} )
>>> test( OFF )
>>>
>>> --
>>> Output
>>>
>>> Included.
>>> ALWAYS Included __ANDROID__
>>> Included.
>>> ALWAYS Included 1
>>> ALWAYS Included OFF
>>>
>>> --
>>>
>>> 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