Re: [CMake] CMake equivalent to Boost.Build site-config.jam oruser-config.jam

2017-08-09 Thread Brian Davis
On Tue, Aug 8, 2017 at 2:31 PM, Lectem  wrote:

> I think that you are looking for the toolchain files :
>
> https://cmake.org/cmake/help/v3.0/manual/cmake-toolchains.7.html
>
>
>
> The other option is to use a cmake script to specify your variables which
> includes CMakelists.txt (or the other way around if you can modify the
> CMakelists.txt). This would be quite similar to ctests scripts.
>
> Some good examples are in Daniel Pfeifer’s « Effective cmake » talk
> https://github.com/boostcon/cppnow_presentations_2017/
> blob/master/05-19-2017_friday/effective_cmake__daniel_
> pfeifer__cppnow_05-19-2017.pdf
>
>
>

Wow that PDF is refreshing I have started to see some of these changes to
CMake creep in over the years.  Coming from Boost.Build pre 2009 I had
always longed for CMake to model itself after Boost Build if only a little
bit.

I had long ago complained... ok and still do..  about the underlying
design, scope, documentation (lack of in some cases and misleading/bad
examples see such as), and language problems of CMake.

such as:

https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html and
https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#module:CMakePackageConfigHelpers
which still leave the package developer to use or not use version, put
package (find_package) files "wherever"

project( proj_name VERSION 1.0) not having any bearing on
CMAKE_INSTALL_PREFIX such as C:\Program Files\proj-name and not C:\Program
Files\proj-name-1.0, cuz who doesn't want previous versions blasted
away/written over by default?


It got so bad that I wrapped CMake goop in my own macros (which I even
posted as feature request at http://www.CMake.org/Bug/view.php?id=11807 but
no longer in existence - CMake's Mantis tracker ) to give concise
boost.build inheritable (such as now  INTERFACE) like spec and in so doing
probably violated or committed every bad practice in that pdf, but hey what
choice did I have back then... in trying to keep previous projects
building... not sure what choice I have now..

What I resorted to at the time was I rolled own macros
add_project_executable, add_project_library, and
add_project_configuration.  Where add_project_configuration allowed project
executables and libraries to inherit build properties from configurations:

http://slideplayer.com/slide/6139853/
http://images.slideplayer.com/18/6139853/slides/slide_24.jpg
http://images.slideplayer.com/18/6139853/slides/slide_25.jpg

I know I'll build a Meta Meta (yes that's two Meta's) Build Spec Generator
to take CMake Build Spec and generate a new updated CMake build spec to be
used to generate the build spec to build the code.. eureka!

add_library(Bar Interface)
target_definitions(Bar IINTERFACE BAR = 1)

might get around my need for my add_project_configuration macro and friends.

Sadly the name "add_library" to say add only #defines or include dirs could
more appropriately be add_configuration when not adding a "true" library.

Rather inheriting/using config properties and the statement:

INTERFACE libraries have no build specification
They only give usage requirements

Only adds to the affront on sensibilities, cuz if it's not a library and
has no build spec... errr why the term "library".

IMO:

https://cmake.org/cmake/help/latest/release/3.0.html?highlight=interface#properties

add_library

should unlearn/forget interface and

add_config, add_buildspec, or some other more appropriate name for this.  I
can understand the lazy logic where "libraries" are both inherited/consumed
by libraries and exectuables so put it there kinda logic that must have
resulted in this..


These changes still don't fix the cmake-package and ExternalProject_add
problems and 3rd party developer cat herding I find myself doing these days
on the internet.
-- 

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

Re: [CMake] find_package( ITK ) with ITK version 4.8 and cmake 3.9.0-rc6 (3.1+ anyway) is like finding Dory

2017-08-09 Thread Luis Caro Campos
Hi Brian,

What is the version passed to cmake_minimum_required for your project?
(Typically the first line in your top-level CMakeLists.txt).

I suspect if you set it to a version higher than 3.1 the warnings will
disappear (I believe it is set to a version older than that, hence the
policy warnings).

Regards

On 9 Aug 2017 7:27 pm, "Brian Davis"  wrote:

>
> I am so lost in CMB0054 errors I and internet searches I can't remember
> why I wanted Itk-4.8 in the first place.  Here goes:
>
> When using CMake 3.9.0-rc6 or basically 3.1+ (onward) and trying:
>
> find_package( ITK )
>
> with 4.8 built / installed and receiving:
>
> CMake Warning (dev) at install/lib/cmake/ITK-4.8/ITKTargets.cmake:28 (if):
> Policy CMP0054 is not set: Only interpret if() arguments as variables or
> keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
> details. Use the cmake_policy command to set the policy and suppress this
> warning.
>
> Quoted variables like "" will no longer be dereferenced when the policy is
> set to NEW. Since the policy is not set the OLD behavior will be used.
> Call Stack (most recent call first):
> install/lib/cmake/ITK-4.8/ITKConfig.cmake:50 (include)
> subprojects/ctutil/CMake/ctutil/itk/itk_config.cmake:137 (find_package)
> subprojects/ctutil/CMake/ctutil/Findctutil.cmake:224 (itk_config)
> CMakeLists.txt:123 (find_package)
> This warning is for project developers. Use -Wno-dev to suppress it.
>
> CMake Warning (dev) at install/lib/cmake/ITK-4.8/ITKTargets.cmake:36 (if):
> Policy CMP0054 is not set: Only interpret if() arguments as variables or
> keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
> details. Use the cmake_policy command to set the policy and suppress this
> warning.
>
> Quoted variables like "" will no longer be dereferenced when the policy is
> set to NEW. Since the policy is not set the OLD behavior will be used.
> Call Stack (most recent call first):
> install/lib/cmake/ITK-4.8/ITKConfig.cmake:50 (include)
> subprojects/ctutil/CMake/ctutil/itk/itk_config.cmake:137 (find_package)
> subprojects/ctutil/CMake/ctutil/Findctutil.cmake:224 (itk_config)
> CMakeLists.txt:123 (find_package)
> This warning is for project developers. Use -Wno-dev to suppress it.
>
>
> then looking at line 28 in install/lib/cmake/ITK-4.8/ITKTargets.cmake:28
>
> if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
>
>
> then reading:
>
> https://cmake.org/cmake/help/v3.1/policy/CMP0054.html
>
> I always new CMake was and is broken (language, use, and documentation),
> but never such a realization as now.
>
> and bits like
>
> https://cmake.org/pipermail/cmake/2014-December/059317.html
> https://cmake.org/cmake/help/v3.1/command/cmake_policy.
> html#command:cmake_policy
>
> then ...sigh... then trying:
>
> cmake_policy(PUSH)
> cmake_policy(SET CMP0054 OLD)
> find_package( ITK )
> cmake_policy(POP)
>
> and still getting:
>
> CMake Warning (dev) at install/lib/cmake/ITK-4.8/ITKTargets.cmake:28 (if):
> Policy CMP0054 is not set: Only interpret if() arguments as variables or
> keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
> details. Use the cmake_policy command to set the policy and suppress this
> warning.
>
> and wondering does the cmake_policy push, pop, set do anything here?
>
> I am left wondering who, what, why am I here? Maybe Sigourney Weaver can
> help (see title).
>
> from:
>
> https://en.wikipedia.org/wiki/CMake
>
> "CMake development began in 1999 in response to the need for a
> cross-platform build environment for the Insight Segmentation and
> Registration Toolkit (ITK)"
>
> If only I could get CMake to work with the package it was originally
> created to build.
>
>
> --
>
> 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
>
-- 

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/list

Re: [CMake] CMake equivalent to Boost.Build site-config.jam or user-config.jam

2017-08-09 Thread Brian Davis
Yes PreLoad.cmake was/is exactly what I am looking for.

I tested it and it works minus the bit about it not workging with:

set( CMAKE_GENERATOR_PLATFORM "Visual Studio 12 2013 Win64" )

but hey it's 99.99 percent of what I need.

Now only if I could find that say in the documentation!

Thanks for the heads up on the feature. Nice!

On Wed, Aug 9, 2017 at 5:20 AM, Cristian Adam 
wrote:

>
>
> On Tue, Aug 8, 2017 at 8:08 PM, Brian Davis  wrote:
>
>>
>> Is there a CMake equivalent to a site-config.jam or user-config.jam
>>
>> http://www.boost.org/build/doc/html/bbv2/recipies/site-config.html
>>
>> basically a CMake file the user can put in a project directory that CMake
>> will read first when using cmake-gui that allows user to specify stuff they
>> don't want to have to keep specifying in cmake-gui each "delete cache"
>>
>> such as
>>
>> set( CMAKE_INSTALL_PREFIX ${CURRENT_LIST_DIR}/install CACHE STRING ""
>> FORCE)
>> set( CMAKE_DEBUG_POSTFIX d CACHE STRING "" FORCE )
>>
>>
>> There is cmake.exe
>>
>> -C 
>>
>> but requires command line
>>
>> come to think of it would be nice if
>> set( CMAKE_GENERATOR_PLATFORM "Visual Studio 12 2013 Win64" )
>>
>> in desired user config file and CMake would just "make it so" on clicking
>> Generate.
>>
>> I can do this with my own projects, by implementing it myself, but when
>> checking out 3rd party projs they can be all over the map on config
>> allowing a user-config.cmake would provide mechanism to tame the config
>> problems.
>>
>> Desired workflow
>>
>> 1) Checkout 3rd party proj
>>
>> 2) put a CMakeUser.txt or whatever file per project
>>
>> 3) Run CMake GUI Generate
>>
>> 4) Click Open Project
>>
>> 5) Change whatever manual bits in in gui
>>
>> 6) Update project suing git witch branches versions
>>
>> 7) Delete Cache
>>
>> 8) Return to 3
>>
>> 9) Doopy doopy doo whatever else
>>
>
> There is the (undocumented) PreLoad.cmake
> ,
> which acts like giving a precache file with -C command line argument.
>
> But, as it turns out, it doesn't work with server mode :(
>
> Cheers,
> Cristian.
>
>



-- 
Brian J. Davis
-- 

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

[CMake] find_package( ITK ) with ITK version 4.8 and cmake 3.9.0-rc6 (3.1+ anyway) is like finding Dory

2017-08-09 Thread Brian Davis
I am so lost in CMB0054 errors I and internet searches I can't remember why
I wanted Itk-4.8 in the first place.  Here goes:

When using CMake 3.9.0-rc6 or basically 3.1+ (onward) and trying:

find_package( ITK )

with 4.8 built / installed and receiving:

CMake Warning (dev) at install/lib/cmake/ITK-4.8/ITKTargets.cmake:28 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.

Quoted variables like "" will no longer be dereferenced when the policy is
set to NEW. Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
install/lib/cmake/ITK-4.8/ITKConfig.cmake:50 (include)
subprojects/ctutil/CMake/ctutil/itk/itk_config.cmake:137 (find_package)
subprojects/ctutil/CMake/ctutil/Findctutil.cmake:224 (itk_config)
CMakeLists.txt:123 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at install/lib/cmake/ITK-4.8/ITKTargets.cmake:36 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.

Quoted variables like "" will no longer be dereferenced when the policy is
set to NEW. Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
install/lib/cmake/ITK-4.8/ITKConfig.cmake:50 (include)
subprojects/ctutil/CMake/ctutil/itk/itk_config.cmake:137 (find_package)
subprojects/ctutil/CMake/ctutil/Findctutil.cmake:224 (itk_config)
CMakeLists.txt:123 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.


then looking at line 28 in install/lib/cmake/ITK-4.8/ITKTargets.cmake:28

if("${_targetsDefined}" STREQUAL "${_expectedTargets}")


then reading:

https://cmake.org/cmake/help/v3.1/policy/CMP0054.html

I always new CMake was and is broken (language, use, and documentation),
but never such a realization as now.

and bits like

https://cmake.org/pipermail/cmake/2014-December/059317.html
https://cmake.org/cmake/help/v3.1/command/cmake_policy.html#command:cmake_policy

then ...sigh... then trying:

cmake_policy(PUSH)
cmake_policy(SET CMP0054 OLD)
find_package( ITK )
cmake_policy(POP)

and still getting:

CMake Warning (dev) at install/lib/cmake/ITK-4.8/ITKTargets.cmake:28 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.

and wondering does the cmake_policy push, pop, set do anything here?

I am left wondering who, what, why am I here? Maybe Sigourney Weaver can
help (see title).

from:

https://en.wikipedia.org/wiki/CMake

"CMake development began in 1999 in response to the need for a
cross-platform build environment for the Insight Segmentation and
Registration Toolkit (ITK)"

If only I could get CMake to work with the package it was originally
created to build.
-- 

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

Re: [CMake] HOWTO cmake compatiblity?

2017-08-09 Thread Steffen Dettmer
Hi,

> > > So far I think we need to install cmake into a versionized
> > > directory and invoke it:

I tested with versionized directory and it works really well. For
example when having a symlink

  /opt/toolchain/1.0.0/bin/cmake -> /opt/cmake/3.6.2/bin/cmake

it can be used as:

  $ export PATH=/opt/toolchain/1.0.0/bin/:$PATH
  $ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/toolchain/1.0.0/targets/t1.cmake

Very nice is that then generated files do not depend on PATH,
i.e. when make calls cmake, it calls the initially used cmake by
using the (resolved) full path, in the example /opt/cmake/3.6.2/bin/cmake.

When calling with full path:

  $ /opt/toolchain/1.0.0/bin/cmake \
-DCMAKE_TOOLCHAIN_FILE=/opt/toolchain/1.0.0/targets/t2.cmake

this full path is used (as it is). Also the correct ctest is
executed by make test.

This is just great, exactly what we need.

Steffen
-- 

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


[CMake] file timestamp with symbolic link under Windows

2017-08-09 Thread Manu
Hello CMakers,

I recently switched from CMake 2.8.12 to 3.8.2 and the behaviour of

file(TIMESTAMP MyFile MyFileTimestamp)

changed when MyFileis a symbolic link under Windows.

In 2.8.12 the funtion was reporting of the actual file timestamp pointed by
the symbolic link.
In 3.8.2 the funcitons returns the symbolic link itself timpestamp.

Has this behaviour changed intentionally? I do not find anything related in
the change logs.

Trying to workaround this issue, I stumbled upon get_filename_component
function which I can use to get the realpath of a symbolic link but when I
use it as:

get_filename_component(MyFileRealPath ${MyFile} REALPATH)

MyFileRealPath contains the symbolic link path, not the real path!. I am
currently digging in cmake source code and considering reporting as a bug.

Any comments will be warmly welcomed.

Regards!
-- 

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

Re: [CMake] CMake equivalent to Boost.Build site-config.jam or user-config.jam

2017-08-09 Thread Craig Scott
Something which may be helpful for projects which don't have direct support
for optional config is to hook into their project() command. You can set
the CMAKE_PROJECT__INCLUDE

variable
to the name of a file to pull in as though via an include() command right
after the project() call that  corresponds to. No need to
modify the source code of the  project in any way, since
you're injecting another file from wherever you want to keep it.

On Wed, Aug 9, 2017 at 8:32 PM, Jean-Michaël Celerier <
jeanmichael.celer...@gmail.com> wrote:

> That's a very useful feature to have! Ideally CMake would also try to load
> it recursively up to the "/" folder just like for instance clang-format or
> clang-tidy look for their configuration folders upwards. This would allow
> for instance to easily build all the projects in a certain folder in
> release mode by default or stuff like this.
>
>
>
> ---
> Jean-Michaël Celerier
> http://www.jcelerier.name
>
> On Wed, Aug 9, 2017 at 12:20 PM, Cristian Adam 
> wrote:
>
>>
>>
>> On Tue, Aug 8, 2017 at 8:08 PM, Brian Davis  wrote:
>>
>>>
>>> Is there a CMake equivalent to a site-config.jam or user-config.jam
>>>
>>> http://www.boost.org/build/doc/html/bbv2/recipies/site-config.html
>>>
>>> basically a CMake file the user can put in a project directory that
>>> CMake will read first when using cmake-gui that allows user to specify
>>> stuff they don't want to have to keep specifying in cmake-gui each "delete
>>> cache"
>>>
>>> such as
>>>
>>> set( CMAKE_INSTALL_PREFIX ${CURRENT_LIST_DIR}/install CACHE STRING ""
>>> FORCE)
>>> set( CMAKE_DEBUG_POSTFIX d CACHE STRING "" FORCE )
>>>
>>>
>>> There is cmake.exe
>>>
>>> -C 
>>>
>>> but requires command line
>>>
>>> come to think of it would be nice if
>>> set( CMAKE_GENERATOR_PLATFORM "Visual Studio 12 2013 Win64" )
>>>
>>> in desired user config file and CMake would just "make it so" on
>>> clicking Generate.
>>>
>>> I can do this with my own projects, by implementing it myself, but when
>>> checking out 3rd party projs they can be all over the map on config
>>> allowing a user-config.cmake would provide mechanism to tame the config
>>> problems.
>>>
>>> Desired workflow
>>>
>>> 1) Checkout 3rd party proj
>>>
>>> 2) put a CMakeUser.txt or whatever file per project
>>>
>>> 3) Run CMake GUI Generate
>>>
>>> 4) Click Open Project
>>>
>>> 5) Change whatever manual bits in in gui
>>>
>>> 6) Update project suing git witch branches versions
>>>
>>> 7) Delete Cache
>>>
>>> 8) Return to 3
>>>
>>> 9) Doopy doopy doo whatever else
>>>
>>
>> There is the (undocumented) PreLoad.cmake
>> ,
>> which acts like giving a precache file with -C command line argument.
>>
>> But, as it turns out, it doesn't work with server mode :(
>>
>> Cheers,
>> Cristian.
>>
>>
>> --
>>
>> 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
>>
>
>
> --
>
> 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
>



-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-- 

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

Re: [CMake] CMake equivalent to Boost.Build site-config.jam or user-config.jam

2017-08-09 Thread Jean-Michaël Celerier
That's a very useful feature to have! Ideally CMake would also try to load
it recursively up to the "/" folder just like for instance clang-format or
clang-tidy look for their configuration folders upwards. This would allow
for instance to easily build all the projects in a certain folder in
release mode by default or stuff like this.



---
Jean-Michaël Celerier
http://www.jcelerier.name

On Wed, Aug 9, 2017 at 12:20 PM, Cristian Adam 
wrote:

>
>
> On Tue, Aug 8, 2017 at 8:08 PM, Brian Davis  wrote:
>
>>
>> Is there a CMake equivalent to a site-config.jam or user-config.jam
>>
>> http://www.boost.org/build/doc/html/bbv2/recipies/site-config.html
>>
>> basically a CMake file the user can put in a project directory that CMake
>> will read first when using cmake-gui that allows user to specify stuff they
>> don't want to have to keep specifying in cmake-gui each "delete cache"
>>
>> such as
>>
>> set( CMAKE_INSTALL_PREFIX ${CURRENT_LIST_DIR}/install CACHE STRING ""
>> FORCE)
>> set( CMAKE_DEBUG_POSTFIX d CACHE STRING "" FORCE )
>>
>>
>> There is cmake.exe
>>
>> -C 
>>
>> but requires command line
>>
>> come to think of it would be nice if
>> set( CMAKE_GENERATOR_PLATFORM "Visual Studio 12 2013 Win64" )
>>
>> in desired user config file and CMake would just "make it so" on clicking
>> Generate.
>>
>> I can do this with my own projects, by implementing it myself, but when
>> checking out 3rd party projs they can be all over the map on config
>> allowing a user-config.cmake would provide mechanism to tame the config
>> problems.
>>
>> Desired workflow
>>
>> 1) Checkout 3rd party proj
>>
>> 2) put a CMakeUser.txt or whatever file per project
>>
>> 3) Run CMake GUI Generate
>>
>> 4) Click Open Project
>>
>> 5) Change whatever manual bits in in gui
>>
>> 6) Update project suing git witch branches versions
>>
>> 7) Delete Cache
>>
>> 8) Return to 3
>>
>> 9) Doopy doopy doo whatever else
>>
>
> There is the (undocumented) PreLoad.cmake
> ,
> which acts like giving a precache file with -C command line argument.
>
> But, as it turns out, it doesn't work with server mode :(
>
> Cheers,
> Cristian.
>
>
> --
>
> 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
>
-- 

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

Re: [CMake] CMake equivalent to Boost.Build site-config.jam or user-config.jam

2017-08-09 Thread Cristian Adam
On Tue, Aug 8, 2017 at 8:08 PM, Brian Davis  wrote:

>
> Is there a CMake equivalent to a site-config.jam or user-config.jam
>
> http://www.boost.org/build/doc/html/bbv2/recipies/site-config.html
>
> basically a CMake file the user can put in a project directory that CMake
> will read first when using cmake-gui that allows user to specify stuff they
> don't want to have to keep specifying in cmake-gui each "delete cache"
>
> such as
>
> set( CMAKE_INSTALL_PREFIX ${CURRENT_LIST_DIR}/install CACHE STRING ""
> FORCE)
> set( CMAKE_DEBUG_POSTFIX d CACHE STRING "" FORCE )
>
>
> There is cmake.exe
>
> -C 
>
> but requires command line
>
> come to think of it would be nice if
> set( CMAKE_GENERATOR_PLATFORM "Visual Studio 12 2013 Win64" )
>
> in desired user config file and CMake would just "make it so" on clicking
> Generate.
>
> I can do this with my own projects, by implementing it myself, but when
> checking out 3rd party projs they can be all over the map on config
> allowing a user-config.cmake would provide mechanism to tame the config
> problems.
>
> Desired workflow
>
> 1) Checkout 3rd party proj
>
> 2) put a CMakeUser.txt or whatever file per project
>
> 3) Run CMake GUI Generate
>
> 4) Click Open Project
>
> 5) Change whatever manual bits in in gui
>
> 6) Update project suing git witch branches versions
>
> 7) Delete Cache
>
> 8) Return to 3
>
> 9) Doopy doopy doo whatever else
>

There is the (undocumented) PreLoad.cmake
,
which acts like giving a precache file with -C command line argument.

But, as it turns out, it doesn't work with server mode :(

Cheers,
Cristian.
-- 

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

Re: [CMake] CMake equivalent to Boost.Build site-config.jam oruser-config.jam

2017-08-09 Thread Xavier Besseron
Hi all,

>From my understanding, the toolchain files are only inteneded for
cross-compilation and I'm afraid you will run in some kind of troubles if
you try to use it for something else.

As far I know, this feature you describe does not exist in CMake.

However I have a piece of CMake code that does what you want. Please find
it below. Maybe this can help you.
- By default, it loads the settings from file Local_Settings.cmake. It is
ignored silently if it does not exist
- You can use -DLOCAL_SETTINGS=My_Other_Local_Settings.cmake on the CMake
command line to specify a different file

In a separate file Load_Local_Settings.cmake:


# Default name for Local Settings file

set(DEFAULT_LOCAL_SETTINGS_FILE "${CMAKE_SOURCE_DIR}/Local_Settings.cmake")


# CMake cache option

set(LOCAL_SETTINGS "" CACHE FILEPATH "Path to a file containing Local
Settings to load")


# Set LOCAL_SETTINGS_FILE variable

if(LOCAL_SETTINGS)

  # If cache variable is set, use it and fails if it is not valid

  if(EXISTS "${LOCAL_SETTINGS}" AND NOT IS_DIRECTORY "${LOCAL_SETTINGS}")

set(LOCAL_SETTINGS_FILE "${LOCAL_SETTINGS}")

  else()

message(FATAL_ERROR "'${LOCAL_SETTINGS}' is not a valid file for
LOCAL_SETTINGS")

  endif()

else()

  # Otherwise, try default filename, and ignore silently if it does not exist

  if(EXISTS "${DEFAULT_LOCAL_SETTINGS_FILE}" AND NOT IS_DIRECTORY
"${DEFAULT_LOCAL_SETTINGS_FILE}")

set(LOCAL_SETTINGS_FILE "${DEFAULT_LOCAL_SETTINGS_FILE}")

  else()

set(LOCAL_SETTINGS_FILE "")

  endif()

endif()


# Load the settings from the file if variable is defined

if(LOCAL_SETTINGS_FILE)

  message(STATUS "Using Local Settings from '${LOCAL_SETTINGS_FILE}'")

  include("${LOCAL_SETTINGS_FILE}")

endif()



Then, in your main CMakeLists.txt, just add:


# Load Local Settings

include( Load_Local_Settings.cmake )



For example, in my Local_Settings.cmake file, I put things like:


set(EIGEN3_ROOT "/path/to/eigen/install" CACHE STRING "")

# You can use environment variables too

set(BOOST_ROOT "$ENV{EBROOTBOOST}" CACHE STRING "")




I hope this helps.


Best regards,


Xavier



On Tue, Aug 8, 2017 at 9:31 PM, Lectem  wrote:

> I think that you are looking for the toolchain files :
>
> https://cmake.org/cmake/help/v3.0/manual/cmake-toolchains.7.html
>
>
>
> The other option is to use a cmake script to specify your variables which
> includes CMakelists.txt (or the other way around if you can modify the
> CMakelists.txt). This would be quite similar to ctests scripts.
>
> Some good examples are in Daniel Pfeifer’s « Effective cmake » talk
> https://github.com/boostcon/cppnow_presentations_2017/blob/
> master/05-19-2017_friday/effective_cmake__daniel_pfeifer__
> cppnow_05-19-2017.pdf
>
>
>
>
>
> *De : *Brian Davis 
> *Envoyé le :*mardi 8 août 2017 20:09
> *À : *cmake Mailing List 
> *Objet :*[CMake] CMake equivalent to Boost.Build site-config.jam
> oruser-config.jam
>
>
>
>
> Is there a CMake equivalent to a site-config.jam or user-config.jam
>
> http://www.boost.org/build/doc/html/bbv2/recipies/site-config.html
>
> basically a CMake file the user can put in a project directory that CMake
> will read first when using cmake-gui that allows user to specify stuff they
> don't want to have to keep specifying in cmake-gui each "delete cache"
>
> such as
>
> set( CMAKE_INSTALL_PREFIX ${CURRENT_LIST_DIR}/install CACHE STRING ""
> FORCE)
> set( CMAKE_DEBUG_POSTFIX d CACHE STRING "" FORCE )
>
> There is cmake.exe
>
>
>
> -C 
>
> but requires command line
>
> come to think of it would be nice if
>
> set( CMAKE_GENERATOR_PLATFORM "Visual Studio 12 2013 Win64" )
>
> in desired user config file and CMake would just "make it so" on clicking
> Generate.
>
> I can do this with my own projects, by implementing it myself, but when
> checking out 3rd party projs they can be all over the map on config
> allowing a user-config.cmake would provide mechanism to tame the config
> problems.
>
> Desired workflow
>
> 1) Checkout 3rd party proj
>
> 2) put a CMakeUser.txt or whatever file per project
>
> 3) Run CMake GUI Generate
>
> 4) Click Open Project
>
> 5) Change whatever manual bits in in gui
>
> 6) Update project suing git witch branches versions
>
> 7) Delete Cache
>
> 8) Return to 3
>
> 9) Doopy doopy doo whatever else
>
>
>
>
>
>
>
> --
>
> 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/opensou
> rce/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Dr Xavier BESSERON
Research associate
F