Re: [CMake] Missing dll on program startup - a way automate it?

2019-11-20 Thread Petr Kmoch
Hi.

I haven't used it yet, but I believe the target property
https://cmake.org/cmake/help/latest/prop_tgt/VS_DEBUGGER_ENVIRONMENT.html
might help you.

Petr

On Wed, 20 Nov 2019 at 01:02, cen  wrote:

> Hi
>
> Perhaps not really a cmake problem but here we go. An exe depends on a
> few DLLs which I ship in the repo so the rest of the devs don't have to
> build them or fetch them somewhere else. Cmake finds the libraries and
> project builds just fine, until you run it from VS.. you are welcomed by
> the "missing dll" windows error. So I have to copy all the dlls to the
> build/run folder to make it work but this is a manual step. Is there
> some way in cmake/VS to somehow tell the IDE to append the execution
> $PATH with all the specified library dependencies or something along
> those lines? Ideally my goal is to just run cmake, open VS, build the
> project and run, all automagical.
>
> I would prefer to keep the dynamic linking.
>
>
> Best regards, cen
>
> --
>
> Powered by kitware.com/cmake
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit https://cmake.org/services
>
> Visit other Kitware open-source projects at
> https://www.kitware.com/platforms
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
> This mailing list is deprecated in favor of https://discourse.cmake.org
>
-- 

Powered by kitware.com/cmake

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit https://cmake.org/services

Visit other Kitware open-source projects at https://www.kitware.com/platforms

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

This mailing list is deprecated in favor of https://discourse.cmake.org


Re: [CMake] Using generator expression with add_library

2019-11-07 Thread Petr Kmoch
Hi.

The argument STATIC or SHARED is processed at CMake configure time (that
is, when CMake is executing the add_library() command). However, generator
expressions are only evaluated at generate time, which comes only after all
CMake code is processed.

Fortunately for you, compiler ID is something that is already known at
configure time, meaning you don't need to use a genex to read it. You can
just do this:

if(MSVC)
  set(LibType STATIC)
else()
  set(LibType SHARED)
endif()
add_library(
  ${_star_lib_name}
  ${LibType}
  ...
)

(Feel free to modify the if(), use CMAKE__COMPILER_ID (
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html)
etc. as necessary).

Petr

On Thu, 7 Nov 2019 at 12:28, David Aldrich 
wrote:

> I want to build a shared library for Linux and a static library for
> Windows. So I have tried:
>
>  set (_star_lib_name "StdStars")
>
>  add_library(${_star_lib_name}
>  $<$:SHARED>
>  $<$:STATIC>
>  ""
>  )
>
> but that gives me error:
>
> CMake Error at 
> C:/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019/StarLibs/StdStars/CMakeLists.txt:7
>  (add_library):
> Cannot find source file:
>
> STATIC
>
>   Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
>   .hpp .hxx .in .txx
>
> What is the correct way of doing this please?
> --
>
> 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] Recover help text from option() ?

2019-10-09 Thread Petr Kmoch
On Wed, 9 Oct 2019 at 11:11, Ellon Paiva  wrote:

> Another somehow related question: is there a way to recover the name of
> all options defined in a project?
>
>
>
You should be able to get this by reading the directory property
CACHE_VARIABLES (
https://cmake.org/cmake/help/latest/prop_dir/CACHE_VARIABLES.html ) and
going from there (querying variable types etc.), but note that it's
"intended for debugging purposes." Please read the docs on cache variable
properties (
https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#properties-on-cache-entries
) to see what's possible.

Petr
-- 

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] Recover help text from option() ?

2019-10-09 Thread Petr Kmoch
Hi Ellon.

On Wed, 9 Oct 2019 at 09:51, Ellon Paiva  wrote:

> Hi there,
>
> I was wondering if there was a way to recover the help text passed to an
> option to be used later below in the same CMake script.
>
> I saw that the help text goes into a comment before the option on the
> CMakeCache.txt, but is it stored in any recoverable variable during the
> script processing ?
>
>
Since option() just creates a cache variable, you should be able to
retrieve that variable's HELPSTRING property (
https://cmake.org/cmake/help/latest/prop_cache/HELPSTRING.html ):

  option(SampleOpt "Help")
  get_property(result CACHE SampleOpt PROPERTY HELPSTRING)

Petr
-- 

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] set_target_properties ( INTERFACE_INCLUDE_DIRECTORIES ...)

2019-09-13 Thread Petr Kmoch
For completeness, there is also OPTION C:

  set_property(TARGET target PROPERTY INTERFACE_INCLUDE_DIRECTORIES
directory1 directory2)

set_target_properties() is a shorthand for setting several properties at
once, so it assumes its arguments are prop value prop value. If you need
finer control, such as appending or easy way to pass multiple values, use
the full power of set_property().

Petr

On Fri, 13 Sep 2019 at 06:24, Theodore Hall  wrote:

> On Thu, Sep 12, 2019 at 6:31 PM Craig Scott 
> wrote:
>
> OPTION A: Put quotes around a semi-colon separated string if using
>> set_target_properties():
>>
>
> Many thanks.  I had tried quotes, and I had tried a semi-colon, and I
> thought that I had tried them together, but evidently I missed that
> permutation.
>
> I'm actually sticking with OPTION B anyway -- it seems cleaner.  But I was
> mystified looking for OPTION A.
>
> --
>
> Ted Hall
>
> --
>
> 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] Question about config_file.

2019-06-10 Thread Petr Kmoch
Hi Steven.

"what is the configure_file command for?"

https://cmake.org/cmake/help/latest/command/configure_file.html

"what is Doxygen.in?"

Check its contents at wherever you found the example for details, but it
should be a template for the Doxygen configuration file (the config file
read by Doxygen).

Petr

On Sun, 9 Jun 2019 at 00:18, Steven Truppe  wrote:

> Hi everyone,
>
> currently i'm trying to build my doxygen documentation from my
> CMakeLists.txt file. I found the following example that seems to be
> correct:
>
> ##
> ## bsBuildDoxygen() ##
> ##
> macro(bsBuildDocs)
>   if(GENERATE_DOCS)
>   # check if Doxygen is installed
>   find_package(Doxygen)
>   if(DOXYGEN_FOUND)
>   # set input and output files
>   set(DOXYGEN_IN 
> ${CMAKE_CURRENT_SOURCE_DIR}/doc/manual/Doxyfile.in)
>   set(DOXYGEN_OUT 
> ${CMAKE_CURRENT_SOURCE_DIR}/doc/manual/Doxyfile)
>
>   # request to configure the file
>   configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
>   message("Doxygen build started")
>
>   # note the option ALL which allows to build the docs 
> together with the application
>   add_custom_target( doc_doxygen ALL
>   COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
>   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
>   COMMENT "Generating API documentation with 
> Doxygen"
>   VERBATIM )
>   else()
> message("Doxygen need to be installed to generate the doxygen 
> documentation")
>   endif()
>   endif()
> endmacro()
>
> Now my question is about the configure_file command. what is Doxygen.in
> and what is the configure_file command for ?
>
>
> best 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:
> 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] transitive linkage of OBJECT library targets

2019-05-22 Thread Petr Kmoch
Hi Richard,

does it help if you specify the linking as PUBLIC? I.e.:

target_link_libraries(second_object_lib PUBLIC first_object_lib)

Petr

On Wed, 22 May 2019 at 07:48, Richard Szabo  wrote:

> Hi cmakers
>
> I'm trying to get the following example working:
> ```
> cmake_minimum_required(VERSION 3.14)
> project(test_object_lib_nesting)
>
> set(CMAKE_CXX_STANDARD 14)
>
> add_library(first_object_lib OBJECT first.cpp)
>
> add_library(second_object_lib OBJECT second.cpp)
>
> target_link_libraries(second_object_lib first_object_lib)
>
> add_executable(test_object_lib_nesting main.cpp)
>
> target_link_libraries(test_object_lib_nesting second_object_lib)
> ```
>
> The problem I have that the linker command line will have only the
> second.cpp.o for linking the first.cpp.o will not be added as link
> object to the exe. Causing missing symbols on exe linkage.
>
> How to transitively resolve and link "nested" Object library targets ?.
> --
>
> 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] Linked Imported Library in Visual Studio Showing NOTFOUND

2019-04-17 Thread Petr Kmoch
Hi Dustyn,

ELF platforms link against .so files, but Windows links against import
libraries (.lib files) assocaited with DLLs. Does the target 'bar' have the
IMPORTED_IMPLIB property set up correctly? (See
https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_IMPLIB.html )

Petr

On Tue, 16 Apr 2019 at 21:37, Dustyn Blasig  wrote:

> Hi All,
>
> I'm trying to debug an issues where an imported shared library is showing
> up in the linker command as not found, but within the CMake generation the
> target seems to exist.
>
> # CMakeLists.txt 
>
> include(bar.cmake)
>
> add_library(foo SHARED)
>
> if(TARGET bar)
>   target_link_libraries(foo PUBLIC bar)
> endif()
>
> # bar.cmake ###
>
> add_library(bar SHARED IMPORTED)
>
> ...
>
>
> On Linux, the link command contains the correct *-L* and *-lbar*
> options. However, on Windows (Visual Studio) the linker command has
> "bar-NOTFOUND" instead of bar.lib as it should, even though bar should only
> be added as a dependency *if* it exists.
>
> How can I debug why this would happen? Is there a way to have CMake dump
> more information about that target?
>
> Thanks!
> --
>
> 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] install files generator expression

2019-01-09 Thread Petr Kmoch
Hi Lars.

The DESTINATION parameter of install() accepts only a single argument,
which means it's tripping on the line break between the two genexes. Make
it one argument:

INSTALL(FILES ${qt5_locations}
  DESTINATION
$<$:bin>$<$:lib>
  COMPONENT runtime)

This should work.

Petr


On Wed, 9 Jan 2019 at 12:29, Lars  wrote:

> Hello,
>
> We use find_package command in config mode to find Qt 5.11 libraries. The
> libraries are available as imported (Qt5::Core etc).
>
> Our understand is that CMake does not support install of imported targets.
> Therefore we use get_target_property to find actual location of library and
> Install(Files ...) to install the files.
>
> The install command looks like this (and works);
> INSTALL(FILES ${qt5_locations} DESTINATION "bin" COMPONENT runtime)
>
> The documentation states that DESTINATION supports generator expression.
> We would like to use generator expression to install libraries in "bin" on
> Windows and "lib" on Linux but have not be able to accomplish this task.
> The below command generated the following error message "Install files
> given unknown argument  $<$:lib>". We have tried other
> variants but none of them work.
>
> INSTALL(FILES ${qt5_locations}
>   DESTINATION
> $<$:bin>
> $<$:lib>
>   COMPONENT runtime)
>
> Appreicate any input.
>
> kind regards, Lars
>
>
> --
>
> 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] Can an option enforce a default, even if cache is present?

2018-11-28 Thread Petr Kmoch
On Tue, 27 Nov 2018 at 21:42, frodak  wrote:

> On Tue, Nov 27, 2018 at 3:15 PM Mario Emmenlauer 
> wrote:
> >
> > On 27.11.18 17:13, Eric Noulard wrote:
> > > Le mar. 27 nov. 2018 à 14:50, Mario Emmenlauer  > > > a écrit :
> > > Dear all,
> > >
> > > I've just discovered that option() behaves differently than I
> anticipated.
> > > After reading the docs and searching with google I'm still
> confused how to
> > > achieve my desired behaviour.
> > >
> > > What I've just learned is that unspecified options take their
> cached value
> > > and do *not* go back to their default value, if a cache exists. I
> assumed
> > > that options take their default when not explicitly specified.
> > >
> > >
> > > The behavior of option() gained new behavior in CMake 3.13.
> > > May be it could help in your particular case:
> > > https://cmake.org/cmake/help/v3.13/policy/CMP0077.html#policy:CMP0077
> > >
> > > you'll depend on latest CMake though.
> > >
> > >
> > > Now my problem: I could not find a way to get the behaviour I'd
> like. Is it
> > > possible to enforce the default for an option when its not
> specified by the
> > > user, even if a cache exists?
> > >
> > >
> > > You mean you did not manage to force the cache value?
> > > You can:
> > > set(VAR "default_value" CACHE FORCE)
> > >
> > > or the problem is you cannot know whether if a value has been
> user-provided?
> >
> > Sorry, I was not very precise! Your last point is the problem. I fail to
> know
> > when the option was user-provided and when it was cache-provided.
> >
> > So here is what I'd like:
> >
> > #> grep MYOPT CMakeLists.txt
> > option(MYOPT "Description" OFF)
> > #> cmake  # I want the option disabled, this works fine.
> > #> cmake -DMYOPT=ON   # I want the option enabled, this works fine.
> > #> cmake  # I want the option disabled (back to default),
> ># but I observe the option taken from cache,
> enabled.
> >
> > Is there some way to achieve my desired behaviour? I tried without
> success
> > unset(MYOPT), unset(MYOPT CACHE), and set(MYOPT OFF) before option(), but
> > they all lead to different behaviour.
> >
>

You're forgetting one important aspect of CMake: that it can retrigger
itself when a CMake source file changes. Such a run of CMake is
indistinguishable from running it manually, and it's (a large part of) why
the cache exists in the first place. Imagine the following scenario:

User runs >cmake -DMYOPT=ON
User edits a CMakeLists.txt (or even just a file processed by
configure_file()).
User runs >make

As part of this make, CMake triggers to regenerate the buildsystem. If
MYOPT exhibited the behaviour you request, it would silently get disabled
again, even though this is most definitely not what the user expects. I
addressed a similar point in this StackOverflow answer:
https://stackoverflow.com/a/41361741/1782465

Petr


>
> I've always used 'cmake -UMYOPT'  to remove specific items from the
> cache (or edit the cache file directly).
> I don't think the notion of user-provided or cache-provided entries
> exist because all user defined variables go into the cache.
> Then you can test to see if MYOPT is set and then use the default
> value when recreating the cache entry.
> Also cmake cache variables are persistent between invocations so the
> user doesn't need to keep specifying them at the command line every
> time cmake needs to run.
>
> Best 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:
> 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] target_compile_flags and PUBLIC

2018-10-09 Thread Petr Kmoch
 Hi John,

you could put those flags as PUBLIC into a separate INTERFACE target (let's
call it hpxFlags) and then do

  target_libraries(hpx PRIVATE hpxFlags)

Then create another interface target hpxForTests to combine those two
targets:

  target_link_libraries(hpxForTests PUBLIC hpx hpxFlags)

And then link all the tests to hpxForTests instead of to hpx.

Petr


On Tue, 9 Oct 2018 at 09:48, Biddiscombe, John A.  wrote:

> I have a problem with exported flags from a project.
>
> If I use `target_compile_options(hpx PUBLIC ${flags})` hpx is compiled
> with the flags, and all 500+ tests within the project that depend on hpx
> inherit the flags too, so they get built correctly. However, the
> `HPXTargets.cmake` file that is generated with the exported targets, also
> inherits these flags and lists them in INTERFACE_COMPILE_OPTIONS, so now
> users are complaining that flags used to compile hpx are being passed onto
> their project and some of the stuff we use like `-Werror=sign-compare`
> causes a build fail in their project. If I use `target_compile_options(hpx
> PRIVATE ${flags})` then the flags are not passed on to the user projects,
> but also not passed on to the tests either. Is there an easy way of saying,
> pass these flags to all my projects within this 'PROJECT' but don't export
> them via the PUBLIC/INTERFACE to 3rd party users?
>
> Thanks
>
> JB
> --
>
> 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] Find parent of ${PROJECT_SOURCE_DIR}

2018-08-28 Thread Petr Kmoch
Hi,

can you elaborate on how the commands you've shown "don't work?" What do
they do and how does it differ from what you need?

Petr

On Tue, 28 Aug 2018 at 08:33, Ke Gao  wrote:

> Hi,
>
> I tried different way of using GET_FILENAME_COMPONENT to find the parent
> path of PROJECT_SOURCE_DIR, or another path relative to the parent of
> PROJECT_SOURCE_DIR, never succeeded.
>
> Can anybody help, thank you very much.
>
> None of the following works. I'm using Cmake 2.8.12
> GET_FILENAME_COMPONENT(SRC_DIR ${PROJECT_SOURCE_DIR}/../source/ PATH)
> GET_FILENAME_COMPONENT(SRC_DIR ${PROJECT_SOURCE_DIR}/../source/ ABSOLUTE)
> GET_FILENAME_COMPONENT(ANA_ROOT_DIR ${PROJECT_SOURCE_DIR} ABSOLUTE)
> --
>
> ..
> Ke Gao
> --
>
> 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] CMake specify using either NVCC or host compilers with add_executable

2018-08-27 Thread Petr Kmoch
Hi Quang,

I believe this should be doable with setting the source file's LANGUAGE
property ( https://cmake.org/cmake/help/latest/prop_sf/LANGUAGE.html ):

add_executable(foo_cuda foo.cpp)
set_property(SOURCE foo.cpp PROPERTY LANGUAGE CUDA)

Petr

On Mon, 27 Aug 2018 at 17:40, Quang Ha  wrote:

> Hi all,
>
> With the new way CMake is treating CUDA codes, now we can do:
>
> project(foo LANGUAGES CXX CUDA)
>
> and can do:
>
> add_executable(foo_cuda foo.cu) # will use NVCC
> add_executable(foo_cpp foo.cpp) # will use host compilers
>
> Now since CUDA can take *.cpp files as extension (see
> https://stackoverflow.com/questions/26208784/cuda-cpp-files), is there a
> away to flip the compiler using one single source files? Something along
> the line of:
>
> if(CUDA_FOUND)
>   add_executable_with_nvcc(foo_cuda foo.cpp) # of course this doesn't exist
> else(CUDA_FOUND)
>   add_executable_with_cpp(foo_cpp foo.cpp) # neither does this
> endif(CUDA_FOUND)
>
> Or would anyone suggest a work-around? With the help of add_definitions, I
> can manually compile a host and device executable - just need to integrate
> this final step into the project.
>
> Thanks,
> Quang
>
> --
>
> 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] Using ExternalProject with find_library and find_path

2018-08-24 Thread Petr Kmoch
Hi Alex,

the standard solution to this is to use a Superbuild approach, in which the
top-level CMakeList contains *only* ExternalProject calls. That means your
actual project becomes just another "external" project in this superbuild,
which allows you set up all build dependencies etc. as necessary. Then, you
proceed like this:

* First generate and build the Superbuild
* Then switch to your real project within the superbuild infrastructure,
and do all further development there. You're guaranteed all your
dependencies are already available by them having been built as part of the
Superbuild step above.

Googling for "CMake ExternalProject superbuild" should give you more info.

Petr

On Fri, 24 Aug 2018 at 12:06, Alexander Dahl  wrote:

> Hei hei,
>
> for a standalone build without system libraries I was experimenting
> with the ExternalProject module today. My goal is to have some top
> level build project which includes several CMake projects and some
> external projects without relying on dev libraries installed on the
> system (reason are basically incompatible library versions). However
> those CMake projects should not be altered and should also be capable
> of building against dev libs from the system or in a cross compile
> environment like ptxdist. I created a simple example project to build
> OpenSSL with the ExternalProject module, and link either that or the
> OpenSSL lib from the system:
>
> https://github.com/LeSpocky/effective-succotash
>
> (Note: using MD5 inside this example program is really just a very
> simple example, the real application will use more of OpenSSL, so that
> one is really needed, please no suggestions for alternatives. ;-) )
>
> (Also note: some things were inspired by the FindOpenSSL.cmake coming
> with CMake 3.9).
>
> This works in general with one minor flaw. When building OpenSSL as
> external project, I have to run the build twice, because find_library
> and find_path obviously fail to find OpenSSL in the build tree before
> it is built. I could set those paths by hand with a priori knowledge
> were the OpenSSL build will put its output, but that seems like an
> unelegant solution to me.
>
> Any hints on that topic? What I found on the web was basically things
> from several years ago, I would appreciate a more modern CMake
> approach with imported targets. ;-)
>
> Greets
> Alex
>
> --
> /"\ ASCII RIBBON | »With the first link, the chain is forged. The first
> \ / CAMPAIGN | speech censured, the first thought forbidden, the
>  X  AGAINST  | first freedom denied, chains us all irrevocably.«
> / \ HTML MAIL| (Jean-Luc Picard, quoting Judge Aaron Satie)
> --
>
> 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] Best practice for configuration-dependent defaults?

2018-08-24 Thread Petr Kmoch
Hi Sam,

it seems to me that your user-facing option is not actually Boolean, but
tri-state: On vs. Off vs. Use_default. So I would represent it accordingly:
present the user with a string variable (with suitable STRINGS property
https://cmake.org/cmake/help/latest/prop_cache/STRINGS.html), and then
control my internal CMake logic like this:

if(FOO STREQUAL "USE_DEFAULT")
  # ...
elseif(FOO)
  # user turned FOO on
else()
  # user turned FOO off
endif()

Petr

On Fri, 17 Aug 2018 at 19:18, Sam Edwards  wrote:

> Hi all!
>
> I have a project with some options that have different defaults depending
> on the configuration used to build the project. For example, support for a
> certain (easy to support, but relatively uncommon) file format should be on
> by default, except when building in the MinSizeRel configuration. Or
> inclusion of a certain optional troubleshooting feature should be on by
> default only when building for Debug, and should default to off in all
> other configurations.
>
> For single-configuration generators, this is pretty easy: I just look at
> the CMAKE_BUILD_TYPE variable and switch the option() defaults depending on
> the selected build type, then generate my config.h once.
>
> I'm trying to support multi-configuration now. My current plan is to
> generate one config.h per build configuration (e.g. include/Debug/config.h,
> include/MinSizeRel/config.h, ...) so that the options which the user hasn't
> explicitly set can have different per-configuration values depending on
> their per-configuration defaults.
>
> However, where I'm getting stuck is in changing the default for an option
> and having that default take precedence when the user hasn't overridden the
> option explicitly. I can't just do something like:
> option(FOO "This is foo" ON)
> message("FOO is ${FOO}")
> option(FOO "This is foo" OFF)
> message("FOO is ${FOO}")
>
> ...because the first option(FOO ...) sets it to ON when it sees it isn't
> in cache and isn't selected by the user, so the second option(FOO ...)
> thinks it's already been set explicitly. Unless there's some way of
> distinguishing "ON because it's the default" from "ON because the user
> explicitly requested it" while having everything still show up correctly in
> the GUI, this won't work.
>
> Is this really the best practice for what I'm trying to do, or is there a
> better "CMake way" to do this? How do you folks solve this problem in your
> own projects?
>
> Thanks,
> Sam
> --
>
> 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] Is cmake failed with any Error message?

2018-08-23 Thread Petr Kmoch
Hi Maomao.

The output includes this line:

  Configuring incomplete, errors occurred!

This means that indeed, CMake has failed to configure the project. Which
means no Makefile (or oher buildsystem) was generated and therefore the
project cannot be built.

A successful run of CMake ends with output like this:

  Configuring done
  Generating done
  Build files have been written to ...

Petr

On Mon, 13 Aug 2018 at 09:13, maomao  wrote:

> Dear admin,
>
> I am trying to build a project that is a open source and have a package on
> the website.
> The required binaries are installed by macports on my macbook pro with
> OSX10.13.6 (High Sierra).
> When I tried to cmake the project, I got the output message as:
>
> es2039:build maomao$ cmake ..
>
> -- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
>
> -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS
> OpenMP_CXX_LIB_NAMES)
>
> -- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
>
> -- HDF5: Using hdf5 compiler wrapper to determine C configuration
>
> CMake Error at /opt/local/share/cmake-3.12/Modules/UseSWIG.cmake:509
> (message):
>
>   SWIG_ADD_LIBRARY: python;quakelib.i: unexpected arguments
>
> Call Stack (most recent call first):
>
>   quakelib/python/CMakeLists.txt:10 (SWIG_ADD_LIBRARY)
>
>
>
> -- Configuring incomplete, errors occurred!
>
> See also "/Users/maomao/VirtualTaiwan/build/CMakeFiles/CMakeOutput.log".
>
> and failed when I proceeded to make.
> So, the question is:
> Is the project configured or not with any error message like that?
> What kind output should I see when I succeed to configure the project by
> cmake?
> If cmake is failed to configure project, the code could not be build by
> make anyway?
>
> Best,
> Maomao
> --
>
> 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-developers] why can target_include_directories() not be applied to custom targets?

2018-07-08 Thread Petr Kmoch
Hi Drew,

a custom target can do literally anything, it's just a buildsystem wrapper
for running arbitrary executables; or often not even that, and is just a
collection of custom commands. There is nothing CMake automatically does
with the properties [INTERFACE_]INCLUDE_DIRECTORIES set on a custom command.

Note that if you need the properties set for some reason (i.e. if your
custom command/target code uses them for something), you can still set them
just fine using set_property() or set_target_properties(). However, I
expect this to be a very rare thing to do, so I think it's OK
target_include_directories() actually errors out on custom targets. IMO
it's much more likely that a non-custom target was intended.

(Note that I am just an ordinary CMake user, so the above is in no way
"official.")

Petr

On 7 July 2018 at 21:27, Drew Parsons  wrote:

> Commit 510fdcb18801076e2041eaae2941375eecc93ec2 at
> https://gitlab.kitware.com/cmake/cmake/commit/
> 510fdcb18801076e2041eaae2941375eecc93ec2
> prevents custom targets from using target_include_directories().
>
> This makes no sense to me.  A custom target is still a target. It needs
> to be compiled, it uses -I flags.
>
> Can you explain the ban on applying target_include_directories() to
> custom targets?
>
> Drew
>
> --
>
> 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-developers
>
-- 

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-developers


Re: [CMake] Adding a target to 'all' that was previously excluded

2018-07-04 Thread Petr Kmoch
Hi Andrew.

All that the EXCLUDE_FROM_ALL argument of add_executable() does is set that
target's property EXCLUDE_FROM_ALL to TRUE. So all you need to do is set
that property to false again:

  set_property(TARGET blah PROPERTY EXCLUDE_FROM_ALL FALSE)

Petr

On 4 July 2018 at 08:48, Marc CHEVRIER  wrote:

> You can use a new target, built by all, depending on your initial target:
>
> add_custom_target(build_blah_X ALL)
> add_dependencies(build_blah_X blah_X)
>
>
> Le mer. 4 juil. 2018 à 03:33, Andrew White  a
> écrit :
>
>> How do I add an excluded (executable) target to the build.  I know that
>> if I add a library EXCLUDE_FROM_ALL and then create a dependency on that
>> library then that the library will be built anyway.  How do I trigger
>> similar behaviour from an executable target?
>>
>> Example:
>>
>> Directory A contains a CMakeLists.txt that builds half a dozen
>> utilities. As part of my project, I want to add a single target from that
>> list.
>>
>> I can include the build info without auto-adding all targets by going:
>>
>> Add_subdirectory(blah EXCLUDE_FROM_ALL)
>>
>> How do I then add target blah_X to my 'all' build?  Or is there another
>> way to approach this?
>>
>> Thanks
>>
>> --
>> Andrew
>>
>> --
>>
>> 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
>
>
-- 

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] CMake, Visual Studio, do not generate absolute paths

2018-07-03 Thread Petr Kmoch
I was going to suggest SUBST as well.

However, note that CMake doesn't need to be installed using a
system-recognised installer, you can just unzip a distribution anywhere you
do have write access. In all seriousness, Visual Studio is a much more
dangerous program than CMake will ever be, as it (= VS) allows you to run
arbitrary code.

Petr

On 3 July 2018 at 09:33, Jano Svitok  wrote:

> Can you create the tree on the machine 1 so it looks the same as on
> machine 2 and thus the absolute paths would be the same?
> For example
> - by using SUBST to create virtual drive at the source root,
> - by creating whole virtual machine on machine 1
>
> https://docs.microsoft.com/en-us/windows-server/administration/windows-
> commands/subst
>
> Jano
>
>
-- 

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] how to deprecate a target?

2018-07-02 Thread Petr Kmoch
Hi Bram.

Wild idea: could you also define a non-namespaced target `foo` and craft it
such that linking against it generates a linker warning? Something like
"Warning: symbol `Using_just_foo_is_deprecated_use_Foo_foo_instead` defined
twice, ignoring weak definition."

Petr

On 2 July 2018 at 00:11, Bram de Greve  wrote:

> That is unfortunate ... do you know any not-so-nice ways?
>
> So, what would you recommend here?
>
> I'm deprecating the old ways to use the Foo package (using Foo_LIBRARIES
> and Foo_INCLUDE_DIRS. You know, the cmake 2.x way of things). I can do that
> nicely with variable watches.
>
> But what about the target names?  If I want to guarantee a seamless
> transition period, I should opt to keep using the "foo" target names.  But
> then there's no way to "upgrade" to "Foo::foo" targets without breakage,
> since there's no deprecation strategy. And I can't use target aliases,
> since that is not allowed on imported targets.
>
> To answer my own question, I think the best thing is to move to the
> "Foo::foo" targets right now.  There's at least one downstream package that
> will be hurt by this, but the damage is less than waiting for everyone to
> have moved to the "foo" target first.
>
> Best,
>
> Bram.
>
>
>
> On 6/29/2018 20:22, Robert Maynard wrote:
>
>> I am not aware of a nice way to setup CMake to error out if a user
>> links to `foo` instead of `Foo::foo`.
>> On Fri, Jun 29, 2018 at 2:05 AM Bram de Greve  wrote:
>>
>>> Hi all,
>>>
>>> Consider this situation.  I'm building a Foo packaged, to be used by a
>>> Bar project.
>>>
>>> Foo used to export its target as simply foo.
>>> Now it exports its target as Foo::foo.
>>>
>>> Bar contains this:
>>> add_library(bar ...)
>>> target_link_libraries(bar foo)
>>>
>>> This of course must now be:
>>> add_library(bar ...)
>>> target_link_libraries(bar Foo::foo)
>>>
>>> But if bar still links to the foo instead of Foo::foo, then CMake
>>> doesn't really complain.  foo doesn't exist, but configures and
>>> generates just fine.  Of course, you'll face strange build errors, from
>>> which it isn't immediately apparent what's causing this ...
>>>
>>> How can I make sure CMake will complain loudly when bar still links to
>>> foo?
>>>
>>> Thanks,
>>> Bram.
>>>
>>> --
>>>
>>> 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/opensou
> rce/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] compiling for both python2 and python3

2018-06-22 Thread Petr Kmoch
Hi Alexander.

No time for a full answer now, but a hint: it's possible to
add_subdirectory() the same CMakeLists.txt multiple times, if you use a
different binary dir each time. You can set some variables in the parent
CMakeList and use them in the child one to generate slightly different
projects from the same source.

Petr

On 22 June 2018 at 10:33, Alexander Bürger  wrote:

> Hi,
>
> I am trying to find a good way to compile a python module for a c++
> library using boost-python for both python2 and python3 in the same
> compilation. So far, The only solution I found for using
>
> FIND_PACKAGE(PythonInterp REQUIRED)
> FIND_PACKAGE(PythonLibs REQUIRED)
> FIND_PACKAGE(Boost REQUIRED COMPONENTS python # or python3)
>
> with different python versions is to use one CMakeLists.txt per python
> version, each in a subdirectory, and with almost equal contents. I would
> appreciate suggestions for a better approach, with less duplication.
>
> Best regards,
>
> Alexander Bürger
> MET Norway
>
>
> --
>
> 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] cpp macro

2018-06-04 Thread Petr Kmoch
On 4 June 2018 at 10:16, Eric Noulard  wrote:

>
>
> In both cases I don't know how to discover that in a cross-platform way.
> Probably MSVC has another option for pre-processsing.
>

The basic option is /P, with related options /EP and /C which control line
numbering, comment suppression etc.

Petr


On 4 June 2018 at 10:16, Eric Noulard  wrote:

>
>
> Le lun. 4 juin 2018 à 09:59, Stéphane Ancelot 
> a écrit :
>
>> hi
>>
>> is there a mactro for cpp ?
>>
>
> You mean a CMake variable which would contain the path to C preprocessor
> binary?
>
> I don't think so, at list no xxx__xxx variable seems to exists for
> that.
> Did you check "cmake --help-variable-list" ?
>
> May be you can ask the compiler to act a the C pre-processor?
>
> clang and gcc both accept the '-E' command line option to only run the
> preprocessor.
>
> otherwise you may probably call
>
> find_program(C_PREPROCESSOR NAMES cpp)
>
> In both cases I don't know how to discover that in a cross-platform way.
> Probably MSVC has another option for pre-processsing.
>
> Eric
>
>>
>> Regards,
>>
>> S.Ancelot
>> --
>>
>> 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
>>
>
>
> --
> 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
>
>
-- 

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] How to Compile with -municode for MinGW-w64

2018-05-30 Thread Petr Kmoch
Hi R0b0t1,

add_definitions() is for adding preprocessor macro definitions (-D
options), not for general compilation options such as -m. You should set
the options as compilation options instead, using target_compile_options.
Also, -mwindows should probably not be passed directly; instead, use
CMake's built-in WIN32 argument in add_executable. Overall, it would look
like this:

include_directories (
  "${CMAKE_CURRENT_SOURCE_DIR}"
)

add_executable (
  mtktool
  WIN32
  mtktool.c
)

target_compile_options(
  mtktool PRIVATE -municode
)


Petr

On 30 May 2018 at 04:33, R0b0t1  wrote:

> Hello,
>
> I pass -municode in add_definitions but GCC still complains about the
> wrong type on WinMain, citing it needs an LPSTR argument. With
> -municode set it should require a LPWSTR and should be named wWinMain.
> If I name the function wWinMain the linker complains about a missing
> WinMain, which makes no sense. This works when I create a Makefile
> myself.
>
> CMakeLists.txt as follows.
>
> cmake_minimum_required (VERSION 3.5)
> project (mtktool)
>
> list (
>   APPEND
>   CMAKE_MODULE_PATH
>   "${CMAKE_CURRENT_LIST_DIR}/cmake"
> )
>
> set (mtktool_VERSION_MAJOR 0)
> set (mtktool_VERSION_MINOR 0)
> set (mtktool_VERSION_PATCH 0)
>
> configure_file (
>   "${PROJECT_SOURCE_DIR}/config.h.in"
>   "${PROJECT_SOURCE_DIR}/config.h"
> )
>
> include_directories (
>   "${CMAKE_CURRENT_SOURCE_DIR}"
> )
>
> add_definitions (
>   -municode
>   -mwindows
> )
>
> add_executable (
>   mtktool
>   mtktool.c
> )
>
> Cheers,
>  R0b0t1
> --
>
> 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] CMake custom target doesn't build

2018-05-14 Thread Petr Kmoch
Hi Gil.

The DEPENDS argument of add_custom_target() is for specifying dependency
*files*, not *targets*.

As the docs (
https://cmake.org/cmake/help/latest/command/add_custom_target.html) say,
what you need is add_dependencies().

Also note that you can add the COMMAND directly to the custom target, no
need for a post-build step:

add_custom_target(final_tgt ALL

  COMMAND  ARGS 

)
add_dependencies(final_tgt tgt1 tgt2)

This way, the custom target will depend on tgt1 and tgt2, and thus only
build (run its command) after they're up to date.

Petr

On 14 May 2018 at 15:22, Gil Moses  wrote:

>
>
>
>
> Hi,
>
> I’m posting this after getting no useful reply in StackOverflow:
> https://stackoverflow.com/questions/50198141/cmake-
> custom-target-doesnt-build.
>
>
>
> Using CMake 2.8.8, I'm building two targets using:
>
> add_library(tgt1 SHARED a.cpp)
>
> add_library(tgt2 SHARED b.cpp)
>
> After both are built, I need to run a post build step that depends on both
> targets. I tried many combinations of the following but with no success:
>
> add_custom_target(final_tgt DEPENDS tgt1 tgt2)
>
> add_custom_command(TARGET final_tgt POST_BUILD COMMAND  ARGS
> )
>
> The final target would simply not build, even though its build.make
> contains the custom command.
>
> Tried to use ALL for the custom target, however make attempts to build it
> first while missing the first targets.
>
> And I can't use an add_library or add_executable for the final target,
> since they require specifying source files.
>
> What is the correct way to do it?
>
> ===
>
> Edit: below is a minimal verifiable source code. What it attempts to do is
> to compile code (for Mac) in two architectures and as a post-build to
> create a universal binary using lipo:
>
> cmake_minimum_required(VERSION 2.8)
>
> set(icpc_req_path "/usr/local/bin/icpc-16.0.146")
>
>
>
> set(CMAKE_CXX_COMPILER "${icpc_req_path}")
>
>
>
> project("CMakeTest")
>
> set(SOURCE_FILES a.cpp)
>
>
>
> set (TARGET_NAME "TGT")
>
> set(TARGETS "")
>
> set(ARCHITECTURES i386 x86_64)
>
>
>
> foreach(ar ${ARCHITECTURES})
>
> set(CMAKE_CXX_FLAGS_RELEASE "")
>
> set(CMAKE_CXX_FLAGS_DEBUG "")
>
> set(CMAKE_CXX_FLAGS "")
>
>
>
> add_library(TGT_${ar} SHARED ${SOURCE_FILES})
>
> set_target_properties(${TARGET_NAME}_${ar} PROPERTIES COMPILE_FLAGS
> "-arch ${ar} -xSSE3")
>
> set_target_properties(${TARGET_NAME}_${ar} PROPERTIES LINK_FLAGS
> "-arch ${ar}")
>
> set(TARGETS "${TARGETS};lib${TARGET_NAME}_${ar}.dylib")
>
> endforeach(ar)
>
>
>
> message("Targets: ${TARGETS}")
>
> add_custom_target(${TARGET_NAME} DEPENDS ${TARGETS})
>
> add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND "lipo" ARGS
> "-create" ${TARGETS} "-output" "${TARGET_NAME}.dylib")
>
>
>
> And the contents of a.cpp is:
>
> int main(){}
>
>
>
> Thanks,
>
> Gil.
>
>
>
> --
>
> 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] WIN32_EXECUTABLE property with generator expression

2018-05-13 Thread Petr Kmoch
Hi Surya.

Generator expressions are not supported universally in CMake; only some
properties support them, and they are all documented as doing so.
WIN32_EXECUTABLE does not support genexes.

As for a workaround, you could create two executable targets, one which
would only be built in Release and one which would be built in other
configurations. Properties such as EXCLUDE_FROM_ALL and
EXCLUDE_FROM_DEFAULT_BUILD_ might come in handy.

However, I find the whole concept somewhat strange. Why is your executable
so fundamentally different between Release and other configurations?
Perhaps there is a different way of achieving your actual goal, without a
need for this.

Petr

On 13 May 2018 at 13:12, Surya Kiran Gullapalli <
suryakiran.gullapa...@gmail.com> wrote:

> With Cmake-3.11.1 and Visual Studio 2017 generator, I'm trying to set
> WIN32_EXECUTABLE property on executable only for release mode with
> generator expression like this
>
> set_target_properties(target PROPERTIES WIN32_EXECUTABLE $)
>
> The generator expression doesn't seem to be working as I see
> /SUBSYSTEM:CONSOLE link flag for both Debug and Release configurations.
>
> set_target_properties(target PROPERTIES WIN32_EXECUTABLE 1)  is working
> though.
>
> Please help.
> Thanks,
> Surya
>
> --
>
> 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] using ExternalProject_Add when cmake is launched

2018-05-02 Thread Petr Kmoch
Hi Stephane.

ExternalProject is designed to run at *build* time, not at *CMake* time. It
is not really intended for mixing with normal, non-ExternalProject targets
(such as those created by add_library).

When using ExternalProject, the canonical form of operation is a
SuperBuild-style project: your master CMakeLists.txt will contain only
ExternalProject_Add() calls, *including one for your normal project.* Your
normal project becomes just another project managed by the SuperBuild. The
SuperBuild's purpose is to download, configure, build, etc., all the
subprojects. So you generate the SuperBuild and then build it once to get
all the dependencies in place. The you switch to using just the YourProject
"child" of the SuperBuild and do normal development there.

I think googling "CMake ExternalProject_Add superbuild" will give you
enough details to get you going.

Petr

On 2 May 2018 at 10:31, Stéphane Ancelot  wrote:

> include(ExternalProject)
>
> ExternalProject_Add(
> WIN32DEPSV2
> PREFIX ${CMAKE_CURRENT_BINARY_DIR}/WIN32DEPSV2
> DOWNLOAD_DIR .
> STAMP_DIR ./stamps
> SOURCE_DIR   WIN32DEPSV2
> GIT_REPOSITORY g...@numagit.numalliance.com:THIRD_PARTIES/WIN32DEPS.git
> CONFIGURE_COMMAND ""
> BUILD_COMMAND ""
> BUILD_IN_SOURCE 1
> INSTALL_COMMAND ""
> )
>
> add_library(your_other_target ...)
>
> add_dependencies(your_other_target WIN32DEPSV2)
>
> find_package(Freetype REQUIRED QUIET)
>
> Launching cmake does not clone the git folder , but continues and fails
> with the find_package command
>
> CMake Error at /usr/local/cmake-3.10.3-Linux-x86_64/share/cmake-3.10/
> Modules/FindPackageHandleStandardArgs.cmake:137 (message):
>   Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)
> Call Stack (most recent call first):
>   /usr/local/cmake-3.10.3-Linux-x86_64/share/cmake-3.10/Modules/
> FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
>   
> /usr/local/cmake-3.10.3-Linux-x86_64/share/cmake-3.10/Modules/FindFreetype.cmake:157
> (find_package_handle_standard_args)
>   FOX64/CMakeLists.txt:919 (find_package)
>
> Le 02/05/2018 à 09:32, Kai Wolf a écrit :
>
> You probably need to manually add a dependency from your ExternalProject
> to your target that needs the libraries.
> For instance
>
> ExternalProject_Add(fetch_win32_libs ...)
> add_library(your_other_target ...)
>
>
> Greetings
>
> Kai Wolf
>
> http://kai-wolf.me/
> kai.w...@gmail.com
>
> 2018-05-02 8:47 GMT+02:00 Stéphane Ancelot :
>
>> Hi,
>>
>> I have got some win32 libraries dependencies stored in a project .
>>
>> Then I added ExternalProject_Add at beginning of my cmakelists file in
>> order to clone this dependency to be available.
>>
>> and then provide the root path as follow:
>>
>> SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/JPEGLIB/jpegsrc-9c
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/zlib-1.2.3-lib
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/libpng-1.2.37-lib
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/ftgl-binary
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/freetype-dev_2.4.2-1
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/iconv-1.9.2.1
>> )
>>
>>
>> unfortunately, the project is not cloned when cmake is launched and the
>> next dependencies don't find the packages :-(
>>
>> What Can I do ?
>>
>> Regards,
>>
>> S.Ancelot
>> --
>>
>> 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
>
>
-- 

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 

Re: [CMake] use analyze with visual studio

2018-04-11 Thread Petr Kmoch
Hi,

I've never used the CL feature, but as far as CMake syntax is concerned, I
believe you're looking for this:

target_compile_options(const PRIVATE /analyze /analyze:plugin
EspXEngine.dll)

Petr

On 11 April 2018 at 00:23, Tiago Macarios  wrote:

> I am trying to pass the analyze flags to cl.exe, but I cannot figure out
> how to get it working, example:
>
> cmake_minimum_required (VERSION 2.8.11)
> set (CMAKE_VERBOSE_MAKEFILE ON)
> project (cppcore)
> add_executable (const const.cpp)
> target_compile_options (const analyze -analyze:plugin EspXEngine.dll)
>
> how to have cmake to respect that last line? I tried adding quotes, but
> that seems not to work
>
>
-- 

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 <d3c...@gmail.com> 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 <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 <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 

Re: [CMake] Hard to do if in Macro

2018-01-30 Thread Petr Kmoch
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


Re: [CMake] Using SET_TARGET_PROPERTIES and IMPORTED_LINK_INTERFACE_LIBRARIES

2017-12-14 Thread Petr Kmoch
Hi Saad,

have you read the docs on IMPORTED_LINK_INTERFACE_LIBRARIES? (
https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES.html
):

  "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead."

Setting INTERFACE_LINK_LIBRARIES to "LibA;LibB" should do exactly what you
want.

As a side note, the shorthand funciton set_target_properties() and friends
are best suited when multiple properties to one value each. When setting a
list, it's usually more convenient to use the general set_property():

set_property(
  TARGET LibD
  PROPERTY INTERFACE_LINK_LIBRARIES
  LibA LibB
)

Petr


On 14 December 2017 at 03:19, Saad Khattak  wrote:

> Thanks Craig for your reply.
>
> The issue is that both "LibA" and "LibB" have been set using
> "add_library(LibA STATIC IMPORTED)" and "add_library(LibB IMPORTED)" and
> both have some properties that are being set.
>
> Ultimately, CMake recognizes LibA and LibB as CMake library projects, and
> they have their own include and link directories and other library
> dependencies.
>
> The nice thing about using LibA directly is then LibD inherits all the
> include and link directories of LibA and LibB which then get inherited by
> any library or executable that includes LibD (and ultimately, the whole
> point of modern CMake):
>
> set_target_properties(LibD
>   PROPERTIES
> IMPORTED_LINK_INTERFACE_LIBRARIES LibA #cmake recognizes LibA as
> IMPORTED CMake libraries
> )
>
> If I use "LibA;LibB" then first, I have to manually extract the library
> names of the imported CMake libraries LibA and LibB. Then, I have to call
> "target_include_directories" and "target_link_libraries" for all
> dependencies of LibA and LibB, even though these dependencies were defined
> in their own respective CMake files when calling "add_library(LibA STATIC
> IMPORTED)"
>
> set_target_properties(LibD
>   PROPERTIES
> IMPORTED_LINK_INTERFACE_LIBRARIES "LibA;LibB" #cmake no longer
> recognizes LibA and LibB as IMPORTED CMake libraries
> )
>
> Regards,
> Saad
>
> On Wed, Dec 13, 2017 at 4:32 PM Craig Scott 
> wrote:
>
>> On Thu, Dec 14, 2017 at 8:22 AM, Saad Khattak 
>> wrote:
>>
>>> Hi,
>>>
>>> I have several imported libraries:
>>>
>>> LibA
>>> LibB
>>> LibC
>>>
>>> Where each imported library has been populated by (where ${LIB_NAME} is
>>> either LibA, LibB or LibC):
>>>
>>> add_library(${LIB_NAME} STATIC IMPORTED)
>>>
>>> And each library has the properties IMPORT_LOCATION_${CONFIGURATION}
>>> set properly:
>>>
>>> set_target_properties(${LIB_NAME}
>>> PROPERTIES IMPORTED_LOCATION_DEBUG # same for release
>>>"location/of/library.lib"
>>> )
>>>
>>> Now let's say I have another imported library LibD that depends on LibA
>>> and LibB such that any executable that uses LibD must also link with LibA
>>> and LibB. To do that, I use:
>>>
>>> set_target_properties(LibD
>>>   PROPERTIES
>>> IMPORTED_LINK_INTERFACE_LIBRARIES LibA LibB
>>>   )
>>>
>>
>> You probably want this instead:
>>
>> set_target_properties(LibD
>>   PROPERTIES
>> IMPORTED_LINK_INTERFACE_LIBRARIES "LibA;LibB"
>> )
>>
>>
>> Note that if the property value is a list, you have to provide it as a
>> single string (i.e. "LibA;LibB" rather than LibA LibB)
>>
>>
>>
>> --
>> 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
>
-- 

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] Using CMake include does not seem to work intuatively

2017-12-13 Thread Petr Kmoch
Hi Saad.

I can't comment on whether the behaviour is correct or expectable, but to
get it working the way you want, you can specify the path fully:

include(${CMAKE_CURRENT_LIST_DIR}/Bar.cmake)

Petr


On 13 December 2017 at 01:34, Saad Khattak  wrote:

> Hi,
>
> Let's say I have the following directory structure:
> ~/Repos/MyRepo/CMakeLists.txt
> ~/CMakeFiles/Foo.cmake
> ~/CMakeFiles/Bar.cmake
>
> In the CMakeLists.txt I have the following command:
>
> include(~/CMakeFiles/Foo.cmake)
>
> And in Foo.cmake I have the following command:
>
> include(Bar.cmake)
>
> Turns out that he `include(Bar.cmake)` from `Foo.cmake` fails. This is
> counter to what I would expect (e.g. how #include works in C).
>
> Is this a bug or is this behavior expected? If it's expected, what is the
> workaround? We have a lot of common cmake files which in turn include files
> relative to each other and not the calling CMakeLists.txt.
>
> Thank you,
> 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:
> 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-developers] GCC x cmake

2017-09-20 Thread Petr Kmoch
On Tue, Sep 19, 2017 at 11:34 AM, Ivam Pretti 
wrote:

> I would like to know what are the advantages or difference when compared
>> to GCC compiler.
>>
>>
> I understand from the topic you mean compared to cmake; but the two are
> two different things
> gcc is a compiler
> cmake is a build system that uses compilers
> it'd be more meaningful to say make v cmake...
>
> so there is no comparison... definatly an apples and steak comparison (or
> orange would at least be fruit)
>

I think it's even more accurate to say CMake is not a buildsystem either,
but a *generator* of buildsystems. How it works:

CMake generates a buildsystem (such as Makefiles, build.ninja, a Visual
Studio .sln file). Then a build tool (such as make, ninja, Visual Studio,
XCode) interprets that buildsystem to issue compilation commands. These
commands are executed by a compiler (such as gcc, clang, cl).

I fully agree with comparing GCC to CMake being an apples to steaks
comparison (and I'm stealing that phrase for future use) :-)

Petr
-- 

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-developers

Re: [CMake] Append to property COMPILE_DEFINITIONS

2017-08-11 Thread Petr Kmoch
On 24 July 2017 at 04:32, Florian Lindner  wrote:

>
>
> [snip]
>
> Still, I don't undertand what is wrong with:
>
> set_property(GLOBAL APPEND PROPERTY COMPILE_DEFINITIONS
> $<$:-FOO>)
>
> ?
>

What's wrong is that there is no such global property. See the list of
global properties:
https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#properties-of-global-scope

COMPILE_DEFINITIONS is not among them.

You're therefore effectively creating a new user-defined global property,
which of course has no effect on CMake's behaviour.

Petr
-- 

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] Referencing an OBJECT library

2017-08-11 Thread Petr Kmoch
Hi Edward.

"the reference to that OBJECT library is through $" -
that is not quite true. When you're referring to the object library target
itself (e.g. reading its properties), you use its name just like with any
other target:

  get_property(someVar TARGET xxx PROPERTY TYPE)

However, the genex $ is used when you're specifying
that the sources of another target yyy are to include the objects
comprising the object library xxx:

  add_executable(yyy main.cpp $)

Here, you're not dealing with the object library xxx itself, but with the
objects from which it's composed, so you're referring to these objects
explicitly. It's quite similar to how you'd use other properties of a
target:

  target_sources(yyy $)

would similarly add all sources of target xxx to the target yyy.

Petr

On 20 July 2017 at 22:57, Edward Diener 
wrote:

> According to the CMake docs for an OBJECT library called, let's say,
> 'xxx', the reference to that OBJECT library is through
> $. I understand this but I am curious about the reason
> for such syntax. After all a STATIC or SHARED library 'xxx' you can just
> use xxx to refer to the library. Why the difference in CMake syntax
> reference between OBJECT libraries added with the add_library command and
> STATIC or SHARED libraries added with the add_library command ?
>
> --
>
> 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
>
-- 

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] Can not get C++ 11 support enabled

2017-07-11 Thread Petr Kmoch
As others have suggested, moving the add_executable() after the set() calls
is the correct solution.

The reason is that variables like CMAKE_CXX_STANDARD are used to
pre-initialise a target's properties when the target is created. In other
words, at the time add_executable() is called, CMake will inspect variables
like CMAKE_CXX_STANDARD and use them to initialise the target's properties
like CXX_STANDARD. It's the properties which really control the target's
build. See
https://cmake.org/cmake/help/latest/variable/CMAKE_CXX_STANDARD.html and
https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html for details.

The same applies to add_compile_options(). From its docs (
https://cmake.org/cmake/help/latest/command/add_compile_options.html ):
"Adds options to the compiler command line for targets in the current
directory and below that are added after this command is invoked"

But Craig is right that you shouldn't add `-std` directly, but use
CXX_STANDARD and CXX_EXTENSIONS instead.

Petr

On 11 July 2017 at 07:21, Craig Scott  wrote:

> As well as moving the add_executable() call after you set the various
> CMAKE_CXX... variables, you should also replace the call to
> add_compile_options(-std=c++11) with the following:
>
> set(CMAKE_CXX_EXTENSIONS OFF)
>
>
> On Tue, Jul 11, 2017 at 3:11 PM, Michael Ellery 
> wrote:
>
>>
>> > On Jul 10, 2017, at 10:07 PM, Florian Lindner 
>> wrote:
>> >
>> > Hello,
>> >
>> > my complete cmake file looks like that:
>> >
>> > cmake_minimum_required (VERSION 3.1)
>> > project(Preallocation)
>> > add_executable(prealloc prealloc_parallel.cpp)
>> >
>> > set(CMAKE_CXX_STANDARD 11)
>> > set(CMAKE_CXX_STANDARD_REQUIRED ON)
>> > add_compile_options(-std=c++11)
>> >
>> > find_library(petsc petsc
>> >  PATHS $ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib)
>> > if(NOT petsc)
>> >  message(FATAL_ERROR "petsc was not found")
>> > endif()
>> > target_link_libraries(prealloc ${petsc})
>> >
>> > find_package(Boost 1.60.0
>> >  REQUIRED
>> >  COMPONENTS program_options)
>> > target_link_libraries(prealloc ${Boost_LIBRARIES})
>> >
>> > find_package(MPI
>> >  REQUIRED)
>> > target_link_libraries(prealloc ${MPI_LIBRARIES})
>> >
>> > set(COMPILE_FLAGS  ${COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
>> > set(LINK_FLAGS ${LINK_FLAGS} ${MPI_LINK_FLAGS})
>> >
>>
>> I would try moving the add_executable() to the end of the CMakeLists file
>> (after the set() and find_library calls…)
>>
>
-- 

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] Cannot get a 64-bit build of MySQL on a 64-bit Windows machine

2017-07-11 Thread Petr Kmoch
Hi,

when generating a Visual Studio buildsystem with CMake, you can specify the
target architecture. If you don't, the default is 32-bit.

To specify the architecture, either put it into the generator name:

  cmake .. -G "Visual Studio 15 2017 Win64" 

or specify just the architecture using -A:

  cmake .. -A Win64 

See description of -G and -A in CMake docs:
https://cmake.org/cmake/help/latest/manual/cmake.1.html

Petr

On 10 July 2017 at 22:06, A.M. Sabuncu  wrote:

> I am completely new to CMake, and am using to build MySQL 5.7.18 on
> Windows 10 x64, using the following command:
>
> cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST="C:\Boost" -DENABLE_DOWNLOADS=1
>
> I have VS 2017 installed, and I am on 64 bit machine, but for some reason,
> the above command produces the following output:
>
> The CXX compiler identification is MSVC 19.10.25019.0
> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
> Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe
> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
> Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe
> -- works
>
> The correct compiler is in the HostX64/x64 folder.
>
> Thinking that CMake might be looking it up from there, I checked the
> processor architecture environment variable from the same cmd.exe that I
> launched the CMake command from, and here's the result:
>
> PROCESSOR_ARCHITECTURE=AMD64
>
> When I follow the above CMake command with the following:
>
> devenv MySQL.sln /build RelWithDebInfo
>
> I get 32-bit results generated, which is not what I want.
>
> How can I get CMake to generate a 64-bit build?
>
> Thanks so much.
>
>
> --
>
> 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] Non OBJECT libraries and population of $

2017-07-10 Thread Petr Kmoch
Hi David.

In your particular case, you don't have build everything twice. Just make
the SHARED libraries thin wrappers around the OBJECT libraries. Like this:

add_library(obj1 OBJECT a.cpp b.cpp ...)
add_library(lib1 SHARED $)

add_library(obj2 OBJECT c.cpp d.cpp ...)
add_library(lib2 SHARED $)

add_library(combined SHARED $ $)

Petr

On 10 July 2017 at 19:41, David Hunter  wrote:

> Currently you can create an OBJECT library using "add_library(
> OBJECT ...)" this populates $  which can then
> later be used using something like
> "target_sources(name PUBLIC $)". I am wondering if
> there  is some reason that $ can't be populated when
> you create a shared or static library, for instance using
> "add_library( SHARED ...)". Looking at the output the VS 2017
> generators for "add_library( OBJECT ...)" it seems to actually
> build a static library anyway. I suspect that all the  files are
> compiled to object files somewhere for both STATIC and SHARED libraries,
> if so would it not be possible to point $ as these
> object files?
>
> The reason I ask is that we have a a bunch of source code that builds
> in about 100 projects. These projects have a normal hierarchical
> dependency tree. However when distributing we want to create larger
> libraries that are the combination of various subsets of the smaller ones.
> In automake these are called convenience libraries and I suspect they may
> have been the reason for CMake OBJECT in the first place. Given the current
> behaviour we have to build all the projects twice once in SHARED library
> form on once in OBJECT library form. If TARGET_OBJECTS was populated for
> SHARED libraries we would not need to build everything twice as we could
> build everything SHARED but still use TARGET_OBJECTS to build combination
> convenience libraries.
>
> Of course maybe there's already a way to do this without having to
> build twice which I don't know about.
>
-- 

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] Errors when writing manifest

2017-07-06 Thread Petr Kmoch
Hi all.

I'm on Windows and I'm building my CMake project using MSVC. When I select
Visual Studio as the CMake generator, everything works perfectly. However,
when I use either the NMake or Ninja generator (in a properly configured
command prompt), most of my DLL linking steps fail with the following error:

  C:/Program Files (x86)/Windows Kits/8.1/bin/x64/mt.exe : general error
c101008d: Failed to write the updated manifest to the resource of file
"path\to\the.dll". The operation failed.

Re-running the exact same command (`nmake` or `ninja`) without doing
anything else occasionally solves the problem (it seemed to me it was
solved more often with NMake than with Ninja, but I can't be sure), but now
I've reached a point where all remaining DLLs consistently fail to link due
to the manifest issue.

I'd be happy to try to debug/locate the issue myself, but since the error
message I get is so wonderfully unhelpful, I don't know *how* to look into
it, or even where to start. Would anyone have any ideas how to look what
the issue could be?

My googling came up with two possibilities: a race with an antivirus for
checking the binary file, or write protection on the output directory. I've
verified that the directory in not write-protected, and it's in a location
which is excluded from AV checks. And anyway, if either of these were the
cause, I'd expect the exact same errors when using the Visual Studio IDE to
build, but such errors *never* happen there.

Any ideas?

Petr
-- 

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] Question about transitive deps and static libs.

2017-04-19 Thread Petr Kmoch
Hi,

I will offer an alternative phrasing based on what makes me personally
understand this best. It might potentially be useful for the documentation
update you're planning.

`target_link_libraries(A B)` specifies that the code in A needs B to be
added to the produced binary when the binary is *linked*. However, static
libraries are not produced by linking, but by an archiver or librarian
tool. Therefore, B needs to be present for the actual linking step when
this happens further down the chain (when linking an executable or shared
library), regardless of the "privacy" of B in A.

Petr

On 18 April 2017 at 17:44, Eric Noulard  wrote:

> Answering to myself.
>
> This mail by Craig explains a lot:
> https://cmake.org/pipermail/cmake/2016-May/063400.html
>
> Sorry for the noise. I guess I have my answer in there.
> I'll try to propose a documentation update based on Craig's explanation
> because,
> https://cmake.org/cmake/help/v3.8/manual/cmake-buildsystem.
> 7.html#transitive-usage-requirements
>
> does not contains clues on specific treatment for static libs.
>
>
>
>
> 2017-04-18 16:30 GMT+02:00 Eric Noulard :
>
>> I have a question concerning the transitive linking of dependence and
>> static libs.
>>
>> I'm working a on prokect where some shared lib are linked to static lib
>> (do not ask me why).
>> So I do:
>>
>> set(CMAKE_POSITION_INDEPENDENT_CODE True)
>>
>> then I have a bunch of libraries (either static or shared) which depends
>> on each other.
>> I use PRIVATE and PUBLIC specification with target_link_librairies.
>>
>> Now I expected that the transitive link properties would be fullfilled
>> simply i.e. that
>> when some target LIB1 is PRIVATEly link against say pthread. Then if a
>> another
>> lib LIB2 is linked against LIB1 then then "pthread" wouldn't be dragged
>> into the link
>> interface of LIB2.
>>
>> It seems that this is not as simple as I thought and as soon as LIB1 is
>> static
>> then LIB2 gets the dependency (be it PRIVATE or PUBLIC)...
>>
>> Find attached a small example.
>>
>> Is this a bug, a feature or something I didn't catch?
>>
>>
>> --
>> Eric
>>
>
>
>
> --
> 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:
> 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-developers] Feature suggestion: auto-create missing files

2017-04-13 Thread Petr Kmoch
OK, I can see there's quite a few voices against and none for. Idea
scratched.

Thanks everyone for input.

Petr
-- 

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-developers

Re: [cmake-developers] Feature suggestion: auto-create missing files

2017-04-11 Thread Petr Kmoch
Thanks for the quick response, Brad.

On 11 April 2017 at 17:52, Brad King <brad.k...@kitware.com> wrote:

> On 04/11/2017 11:41 AM, Petr Kmoch wrote:
> > Currently, adding a new source file to a CMake-controlled project
> > means doing two things: creating the file on disk, and adding it
> > to the relevant CMakeList add_library() or add_executable() call.
>
> I view this as a matching pair with an implicit sanity check.
>

I sometimes have very deep directory hierarchies (files are 3+ directory
levels below the CMakeLists.txt), with interface header, implementation
header, and implementation source in three different paths down that
hierarchy. Adding one class means adding three very similar lines of CMake
code, and then having to navigate three separate directory paths for adding
the files.


>
> > switch from current behaviour of "error out if source file is not found"
> > to "create empty source file if it's not found."
>
> So a typo in the `CMakeLists.txt` file leads to silent creation of a
> source file instead of an error message?
>

That's why I would make it strictly opt-in. We could even get rid of the
initialisation variable and keep it under full control of the project.


>
> That said, I can see how the proposed feature might be useful when
> iteratively developing in an IDE.  Add the file to `CMakeLists.txt`,
> reconfigure, and open the new (now existing) file to edit in the IDE.
>

Yes, I'm coming from an IDE background (VS, to be precise). It would be
quite helpful there. I've bounced the idea with other people in my team,
and they agreed it would be useful.


>
> > Is this something that would be acceptable into CMake? Any comments?
>
> I'd like to hear more opinions from others before considering it
> upstream.  It feels like a pretty personal workflow right now, and
> can be implemented in CMake code already (perhaps with the `SOURCES`
> target property to avoid separate lists).
>
> If this were to be done I'd first like to see a policy introduced to
> get rid of the magic extension guessing we do now.  Without knowing
> the full file name with confidence we wouldn't be able to create it.
>

I'm perfectly fine waiting for broader comments. As to extension guessing,
right now the creation happens after that step in my prototype code, and
simply uses the name verbatim as supplied. I'm perfectly willing to create
such a guess-disabling policy, though. I've never used the guessing
functionality anyway.

Petr
-- 

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-developers

[cmake-developers] Feature suggestion: auto-create missing files

2017-04-11 Thread Petr Kmoch
Hi all,

I'd like to implement a feature for CMake which I miss there, and I'd like
to get approval for the idea & design before proceeding.

Currently, adding a new source file to a CMake-controlled project means
doing two things: creating the file on disk, and adding it to the relevant
CMakeList add_library() or add_executable() call. To me, this feels like
one operation too many. As a result, nearly all of my personal projects
using CMake end up with some sort of wrapper/pre-call which processes file
lists and creates any missing files before the list is passed to the
add_*() call.

I'd like this behaviour to become an option in CMake itself: allow the user
to switch from current behaviour of "error out if source file is not found"
to "create empty source file if it's not found." I've prototyped the
creation itself and it works, but I'd like to discuss the interface for
enabling this functionality. I was considering an inherited boolean
property on individual source file level, plus a variable which would
pre-initialise the property if set. This way, projects could control it on
the finest scope possible (or on broader scopes, since the prorepty would
recurse to directory & global level), while still providing a simple way to
set it centrally.

As far as naming is concerned, I was considering CREATE_SOURCES_IF_MISSING
for the property, and CMAKE_CREATE_SOURCES_IF_MISSING for the variable.

Is this something that would be acceptable into CMake? Any comments?

Thanks.

Petr
-- 

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-developers

Re: [cmake-developers] Build multiple CMake projects

2017-03-27 Thread Petr Kmoch
Hi Jerry,

from your description, it seems like you might be looking for the CMake
module ExternalProject:
https://cmake.org/cmake/help/latest/module/ExternalProject.html

The idea is that you create a "superbuild" CMake project which consists of
ExternalProject_Add calls and related infrastructure, specifying
dependencies between the projects etc. Building this "superbuild" will then
result in acquiring, building, and installing the individual external
projects, in proper order.

Petr


On 24 March 2017 at 19:35,  wrote:

> Hi,
>
> I have some CMake projects which depend on each other. They provide Config
> scripts (all generated with the help of CMakePackageConfigHelpers) and the
> CMake projects find there dependencies with find_package(). Even the
> transitive dependencies are correctly modelled (exported to the Config
> scripts with find_dependency).
>
> The setup in general is fine. The only drawback is that I have to build
> and install them manually in the correct order. For example A depends on B
> depends on C, I have to build+install first C, than B, then A ...
>
> The number of projects are getting more and more and it's getting harder
> to build them.
>
> So my question:
> a) Is there a CMake way to generate a dependency graph and build them in
> the correct order, i.e., the same as CMake does within a project with the
> targets but this time on project level?
> b) What possiblities are provided by CMake to support this?
> c) Are there tools you can recommend?
>
> jerry
> --
>
> 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-developers
>
-- 

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-developers

Re: [CMake] Intel C Generator for Cmake?

2017-02-15 Thread Petr Kmoch
Hi Tony,

generators are for different *buildsystems*: a generator for Makefiles, a
generator for Visual Studio solutions, a generator for Ninja files, a
generator for Eclipse projects etc.

Intel C and Intel Fortran are compilers, not buildsystems. You should be
able to use them with any generator whose buildsystem supports those
compilers.

On Windows, CMake supports generation of vfproj files using the Visual
Studio generator. I don't know if Intel C has its own Visual Studio project
type in the same fashion, and if so, whether CMake supports it.

One of the setups I maintain uses Visual Studio's C++ compiler and Intel
Fortran compiler on Windows using the Visual Studio generator, and
conceptually, it's as simple as this:

call ...\ifortvars.bat ...
set FC=ifort
cmake ...

Petr

On 15 February 2017 at 12:34, Tony Garratt  wrote:

> I am having to switch to cmake from autotools for a third party tool I
> want to build. We use Intel C and Intel Fortran on Windows. I see no
> mention of an Intel C generator for cmake. I presume this means there is
> not one? If so, can I create my own Intel C generator please?
>
> Rgeards,
> Tony
>
> --
> *Dr Tony Garratt*
>
>
-- 

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] clean custom_target

2016-10-26 Thread Petr Kmoch
Hi Tiago.

The best I can think of is the directory property
ADDITIONAL_MAKE_CLEAN_FILES:
https://cmake.org/cmake/help/latest/prop_dir/ADDITIONAL_MAKE_CLEAN_FILES.html

You can set it to a list of files which will be removed as part of running
`make clean` or its equivalent for other generators.

Petr

On 26 October 2016 at 04:36, Tiago Macarios  wrote:

> Hi,
>
> Is there a way to have a command to be run during a clean?
>
> I have a custom_target which does a fair bit of things and it also has the
> ability to clean up after itself. So conceptually something like this is
> what I am looking for:
>
> add_custom_target(Name ALL
> COMMAND command
> COMMAND_CLEAN command -clean
> )
>
>
> Tiago
>
> --
>
> 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_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)
  #...
endfunction()

Note that this will only help if the funciton is called directly; if called
from another function, it will fail again (since the variable would just be
set in the calling function's scope and not at global level).

However, taking a step back, I believe setting the variable doesn't belong
into the `AddTest` function at all. Looking at it, it seems to be concerned
with creating and setting up one target. IMO, such a function should not
also modify global state. Do not forget that CMAKE_INCLUDE_CURRENT_DIR is
not target-specific in any way; it affects *all* targets in the current
directory.

Therefore, my suggestion would be to move setting it out of the function
altogether and perform it at CMakeList scope. Alternatively, put the
function's declaration into a separate CMake file, along with the set()
command. Then, whoever wants to use the function has to include() that
file, which will also cause them to have CMAKE_INCLUDE_CURRENT_DIR set
accordingly.

Petr

On 25 October 2016 at 00:55, Tiago Macarios  wrote:

> 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)
> set(options)
> set(oneValueArgs FILE FOLDER)
> set(multiValueArgs LIBRARIES)
> cmake_parse_arguments(TEST
> "${options}"
> "${oneValueArgs}"
> "${multiValueArgs}"
> ${ARGN}
> )
>
> # THIS DOES NOT WORK HERE I NEED TO SET IT IN THE PARENT FOLDER
> set(CMAKE_INCLUDE_CURRENT_DIR ON)
>
> get_filename_component(FILE_RAW ${TEST_FILE} NAME_WE)
> add_executable(${FILE_RAW} ${TEST_FILE})
>
> set_target_properties(${FILE_RAW}
> PROPERTIES
> CXX_STANDARD 14
> CXX_EXTENSIONS OFF
> AUTOMOC ON
> AUTOUIC ON
> FOLDER ${TEST_FOLDER}
> )
>
> find_package(Qt5Test)
> target_link_libraries(${FILE_RAW} ${TEST_LIBRARIES})
>
> add_test(NAME ${FILE_RAW} COMMAND ${FILE_RAW})
> endfunction()
>
>
>
>
>
>
>
>
>
>
>
> On Mon, Oct 24, 2016 at 3:48 PM, Craig Scott 
> wrote:
>
>> 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
>> behaviour you want (but changing to a macro has other effects, so make sure
>> you read the docs before going down that path). Also note that setting it
>> in one directory does not make it apply to subdirectories as well, in case
>> that matters in your situation.
>>
>>
>>
>> On Tue, Oct 25, 2016 at 9:42 AM, Tiago Macarios 
>> wrote:
>>
>>> 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 function. If I set it inside the function the
>>> compilation fails with a missing moc file.
>>>
>>> Any ideas?
>>>
>>> Tiago
>>>
>>> --
>>>
>>> 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 

Re: [CMake] How to handle options with more than two possible values?

2016-10-13 Thread Petr Kmoch
Hi.

option() is a handy shortcut for boolean options, but it's little more than
syntactic sugar for a cache variable of type BOOL. To create a tristate
variable, you can do this:

  set(ENABLE_SOMETHING AUTO CACHE STRING "Enable SOMETHING support")  #
create the variable
  set_property(CACHE ENABLE_SOMETHING PROPERTY STRINGS AUTO ON OFF)  #
define list of values GUI will offer for the variable

Then, you can test the variable like this:

  if(ENABLE_SOMETHING STREQUAL "AUTO")
# AUTO was used
  elseif(ENABLE_SOMETHING)
# a true value (such as ON) was used
  else()
# a false value (such as OFF) was used
  endif()

Hope this helps.

Petr

On 13 October 2016 at 13:32, YuGiOhJCJ Mailing-List via CMake <
cmake@cmake.org> wrote:

> Hello,
>
> Regarding the cmake-commands manual [1], the "option" command seems to
> take as argument a boolean constant that can have the two possible values:
> ON or OFF.
>
> I would like to use three possible values for an option: AUTO (as default
> value), ON or OFF.
>
> Example:
> option(ENABLE_SOMETHING "Enable SOMETHING support" AUTO)
>
> But of course this example is wrong because "AUTO" is not ON or OFF.
>
> Regarding the cmake-commands manual [2], the "if" command seems to return
> TRUE when the boolean constant is 1, ON, YES, TRUE, Y, or a non-zero number.
> It returns FALSE when the boolean constant is 0, OFF, NO, FALSE, N,
> IGNORE, NOTFOUND, the empty string, or ends in the suffix -NOTFOUND.
>
> I would like to check the value myself.
>
> Example:
> if(ENABLE_SOMETHING=AUTO)
> message(STATUS "ENABLE_SOMETHING=AUTO")
> endif()
> if(ENABLE_SOMETHING=ON)
> message(STATUS "ENABLE_SOMETHING=ON")
> endif()
> if(ENABLE_SOMETHING=OFF)
> message(STATUS "ENABLE_SOMETHING=OFF")
> endif()
>
> But of course this example is wrong because "=" is not accepted for an
> expression in a "if" command.
>
> So my question is: How to handle options with more than two possible
> values?
>
> Thank you.
> Best regards.
>
> [1] https://cmake.org/cmake/help/v3.7/command/option.html
> [2] https://cmake.org/cmake/help/v3.7/command/if.html
> --
>
> 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] trouble with find_package

2016-08-25 Thread Petr Kmoch
I've never even used a Mac, so I am afraid I can't help you there. But I
would assume there's a setting somewhere in the editor to enable/disable
replacing straight quotes with curly ones.

Petr

On 24 August 2016 at 18:22, Cotton Candy <cottoncandyco...@gmail.com> wrote:

> Hi Petr,
> Indeed those curly quotes were in the code. I am using TextEdit on a Mac
> and when I type the double-quote key I automatically get those curly
> quotes. Fortunately I had some straight quotes elsewhere in my code and I
> copied and pasted those and, voila - that seemed to fix the problem!
> Now the question is, how do I get my keyboard to give me straight quotes
> when I am typing. Any ideas?
> Many thanks for your help.
> Aaron
>
> On Wed, Aug 24, 2016 at 5:21 PM, Petr Kmoch <petr.km...@gmail.com> wrote:
>
>> Hi.
>>
>> In your e-mail, there are curly quotes in the set() command. Is that an
>> artifact of e-mailing, or are they actually present in your code? The
>> latter could indeed cause the error you're seeing.
>>
>> Petr
>>
>> On 24 August 2016 at 17:09, Cotton Candy <cottoncandyco...@gmail.com>
>> wrote:
>>
>>> Hi,
>>> Cmake was having trouble finding the MySQL libraries on my machine so I
>>> tried using find_package with a package finder that I downloaded (
>>> https://gist.github.com/RenatoUtsch/1623340) called FindMySQL.cmake.
>>>
>>> In my CMakeLists.txt file I added:
>>>
>>> 
>>> set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} “/Users/jones/Dropbox/Skedmo/s
>>> kedmo-solver-lean/cmake/”)
>>>
>>> find_package(MySQL)
>>> 
>>>
>>> And I made sure that FindMySQL.cmake was in the directory that I added
>>> to the CMAKE_MODULE_PATH.
>>>
>>> Every time I press "Configure" on the GUI, I get the same warning
>>> message:
>>>
>>> CMake Warning at CMakeLists.txt:38 (find_package):
>>> By not providing "FindMySQL.cmake" in CMAKE_MODULE_PATH this project has
>>> asked CMake to find a package configuration file provided by "MySQL", but
>>> CMake did not find one.
>>>
>>> Could not find a package configuration file provided by "MySQL" with any
>>> of
>>> the following names:
>>>
>>> MySQLConfig.cmake
>>> mysql-config.cmake
>>>
>>> Add the installation prefix of "MySQL" to CMAKE_PREFIX_PATH or set
>>> "MySQL_DIR" to a directory containing one of the above files. If "MySQL"
>>> provides a separate development package or SDK, be sure it has been
>>> installed.
>>>
>>> If I continue with "Generate", ultimately the resulting makefile does
>>> not work. I get errors at the linker stage.
>>>
>>>
>>> A few details about my environment:
>>>
>>> I am working on a MacBook Pro running OS X 10.9.5.
>>> I am using MAMP to run MySQL.
>>> The project builds just fine using Xcode, but I am trying to switch to
>>> CMake.
>>>
>>> Thanks for your help.
>>>
>>>
>>>
>>> --
>>>
>>> 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] trouble with find_package

2016-08-24 Thread Petr Kmoch
Hi.

In your e-mail, there are curly quotes in the set() command. Is that an
artifact of e-mailing, or are they actually present in your code? The
latter could indeed cause the error you're seeing.

Petr

On 24 August 2016 at 17:09, Cotton Candy  wrote:

> Hi,
> Cmake was having trouble finding the MySQL libraries on my machine so I
> tried using find_package with a package finder that I downloaded (
> https://gist.github.com/RenatoUtsch/1623340) called FindMySQL.cmake.
>
> In my CMakeLists.txt file I added:
>
> 
> set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} “/Users/jones/Dropbox/Skedmo/
> skedmo-solver-lean/cmake/”)
>
> find_package(MySQL)
> 
>
> And I made sure that FindMySQL.cmake was in the directory that I added to
> the CMAKE_MODULE_PATH.
>
> Every time I press "Configure" on the GUI, I get the same warning message:
>
> CMake Warning at CMakeLists.txt:38 (find_package):
> By not providing "FindMySQL.cmake" in CMAKE_MODULE_PATH this project has
> asked CMake to find a package configuration file provided by "MySQL", but
> CMake did not find one.
>
> Could not find a package configuration file provided by "MySQL" with any of
> the following names:
>
> MySQLConfig.cmake
> mysql-config.cmake
>
> Add the installation prefix of "MySQL" to CMAKE_PREFIX_PATH or set
> "MySQL_DIR" to a directory containing one of the above files. If "MySQL"
> provides a separate development package or SDK, be sure it has been
> installed.
>
> If I continue with "Generate", ultimately the resulting makefile does not
> work. I get errors at the linker stage.
>
>
> A few details about my environment:
>
> I am working on a MacBook Pro running OS X 10.9.5.
> I am using MAMP to run MySQL.
> The project builds just fine using Xcode, but I am trying to switch to
> CMake.
>
> Thanks for your help.
>
>
>
> --
>
> 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] What is a utility target ?

2016-08-12 Thread Petr Kmoch
Hi all,

a bit late to the party, but in case it's still relevant: targets have a
property named TYPE ( https://cmake.org/cmake/help/latest/prop_tgt/TYPE.html
) which stores the target type as a string:

get_property(type TARGET TargetName PROPERTY TYPE)
if(type STREQUAL "EXECUTABLE" OR type MATCHES "LIBRARY")
  # it's was added by add_executable()/add_library()
else()
  # it wasn't
endif()

Petr


On 27 July 2016 at 23:15, Craig Scott  wrote:

> There may be a way to tell, but nothing is coming to mind at the moment.
> Maybe someone else on the list can chime in?
>
>
> On Thu, Jul 28, 2016 at 5:36 AM, Azharuddin Mohammed <
> azhar...@codeaurora.org> wrote:
>
>> Thanks for the explanation, Craig. Is there a way to detect if the target
>> was a physical file created using add_library/add_executable, or a
>> utility target created using add_custom_target  in order to
>> conditionally call the target_link_libraries command ? There is the
>> condition if(TARGET target-name) , but according to the documentation it
>> returns true for any existing logical target name such as those created
>> by the *add_executable()*
>> 
>> , *add_library()*
>> ,
>> or *add_custom_target()*
>> 
>>  commands.
>>
>>
>>
>> *From:* Craig Scott [mailto:craig.sc...@crascit.com]
>> *Sent:* Monday, July 25, 2016 1:52 PM
>> *To:* Azharuddin Mohammed 
>> *Cc:* CMake 
>> *Subject:* Re: [CMake] What is a utility target ?
>>
>>
>>
>> In the context of that particular part of the CMake documentation, it is
>> referring to targets that are not created by add_library() or
>> add_executable(). Targets created by add_custom_target() are not something
>> CMake knows what to do with if you give them to the target_link_libraries()
>> command, since these custom targets may not (and typically won't)
>> correspond to a physical file being created (that's what
>> add_custom_command() is for). So the term *utility target* can be
>> thought of as being a custom target you create for convenience, but not
>> something which actually corresponds to a library or executable. Examples
>> of utility targets that CMake will automatically create for you include
>> things like *all*, *test*, *package*, etc.
>>
>>
>>
>>
>>
>> On Tue, Jul 26, 2016 at 6:39 AM, Azharuddin Mohammed <
>> azhar...@codeaurora.org> wrote:
>>
>> Hi
>>
>>
>>
>> CMake Policy CMP0039 (https://cmake.org/cmake/help/
>> v3.0/policy/CMP0039.html) mentions that “Utility targets may not have
>> link dependencies” . Can someone please explain what does “utility
>> targets” mean ?
>>
>>
>>
>> Thanks
>>
>>
>>
>> -
>>
>> Azhar
>>
>>
>> --
>>
>> 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
>>
>> http://crascit.com
>>
>
>
>
> --
> Craig Scott
> Melbourne, Australia
> http://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
>
-- 

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:

Re: [CMake] CMake generator executable variable

2016-06-22 Thread Petr Kmoch
Hi Patrick.

If the "subproject" is also CMake-generated, as you say, the best way to
build it would be:

add_custom_target(build-app
  COMMAND ${CMAKE_COMMAND} --build #... other options as appropriate
)

You might also have to set the WORKING_DIRECTORY.

This should give you a generator-agnostic command to build a
CMake-generated project.

Petr

On 22 June 2016 at 16:43, Patrick Boettcher 
wrote:

> Hi list,
>
> In my project some people use Ninja as a generator, some use GNU Make.
>
> In a part of my projects I have a add_custom_command() which runs, for
> convenience, the build of another cmake-generated project in another
> dir using a different set of compilers (which is the reason for not
> being a sub_directory).
>
>   add_custom_target(build-app
>   COMMAND make -C ${APP_BUILD_DIR})
>
> This fails of course if the user decided to use ninja.
>
> We can assume that the caller's build is always using the same generator
> as the callee's one.
>
> I know there is CMAKE_GENERATOR - I could do it with 'IF()', but is
> there a variable carrying the generator-command which I can use to
> replace the bare 'make'?
>
> Thank you in advance.
>
> regards,
> --
> Patrick.
>
>
>
> --
>
> 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] help with OBJECT libraries hierarchy

2016-06-22 Thread Petr Kmoch
Ahoj Miro,

object libraries are not intended for linking. The way it works is you
expand the $ genex into the list of *sources* of the
consuming target. In other words, the string '$' needs
to go into the add_executable(foo) or add_library(foo) command, not into
target_link_libraries(foo).

Petr

On 22 June 2016 at 12:47, Ilias Miroslav  wrote:

> Dear experts,
>
>
> I am trying to introduce OBJECT libraries into our project,
> http://www.diracprogram.org. 
>
>
> Into local src/functionality1/CMakeLists.txt I changed
>
>
> add_library(main ${local_sources})
>
> to
>
> add_library(main  OBJECT ${local_sources})
>
>
> at  higher level, in src/CMakeLists.txt I changed
>
>
> add_subdirectory(${PROJECT_SOURCE_DIR}/src/functionality1)
> set(EXTERNAL_LIBS main ${EXTERNAL_LIBS})
>
>to
>
> add_subdirectory(${PROJECT_SOURCE_DIR}/src/functionality1)
> set(EXTERNAL_LIBS  $ ${EXTERNAL_LIBS})
>
>
> and at the highest level of our CMake infrastructure I have linking of all
> object libraries for given  executable(s) :
>
>
>  target_link_libraries( ${_executable}  ${EXTERNAL_LIBS}  )
>
>
> However, during configuration I am getting repeating error messages  of
> type
>
>
> "CMake Error at cmake/custom/core.cmake:75 (target_link_libraries):
>   Error evaluating generator expression:
>
> $
>
>   The evaluation of the TARGET_OBJECTS generator expression is only
> suitable
>   for consumption by CMake.  It is not suitable for writing out elsewhere.
> Call Stack (most recent call first):
>   CMakeLists.txt:77 (include)"
>
> Any help please how to best arrange OBJECT libraries ? I have cmake
> version 3.5.0 .
>
>
> Yours, Miro
>
>
>
> --
>
> 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] Boost directories are not added to solution file

2016-06-10 Thread Petr Kmoch
Hi David.

Probably something in your CMakeList is set up incorrectly. If you share
that CMakeList, someone might be able to tell what.

Petr

On 10 June 2016 at 13:09, Xi Shen  wrote:

> I created a simple command line tool on Windows, using the Boost library.
> I use the CMake tool to generate the build file for MSBuild.
>
> I set the BOOST_INCLUDEDIR environment variable and CMake generated the
> build file without any error.
>
> However the solution cannot be built by MSBuild. It complains not able to
> find "boost\regex.hpp" file, etc.
>
> I found if I open the solution file and edit the `additional include
> directory` and `additional library directory`, the solution can build
> without error.
>
> So I wonder why CMake did not add those directories to the solution. What
> did I miss?
>
>
> Thanks,
> Daivd
>
> --
>
> Thanks,
> David S.
>
> --
>
> 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] Build-system dependency (as opposed to target)

2016-06-09 Thread Petr Kmoch
Hi James,

I believe you're looking for the directory property CMAKE_CONFIGURE_DEPENDS
( https://cmake.org/cmake/help/latest/prop_dir/CMAKE_CONFIGURE_DEPENDS.html
). Adding a file path to that property causes any changes to that file to
trigger a regeneration:

  set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS version)

If you are using CMake old enough not to have this property, an alternative
workaround is to run configure_file() on the file (even if you never use
the configured result). This will introduce the exact same dependency.

Petr
​
-- 

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] Build a program and get its output during "cmake" run

2016-06-07 Thread Petr Kmoch
Hi Yaron,

I believe you're looking for CMake's try_run() command:
https://cmake.org/cmake/help/latest/command/try_run.html

Petr

On 7 June 2016 at 09:15, Yaron Cohen-Tal  wrote:

> Hi,
>
> I'd like to build a C++ program and get its output during "cmake" run, not
> during the project build. "CHECK_CXX_SOURCE_RUNS" only gives me the exit
> code, but I need the output from the program. Anyway to do it?
>
> Thanx,
> Yaron
>
> --
>
> 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] execute short program during cmake configuration ?

2016-06-03 Thread Petr Kmoch
Hi Miro,

looks like you want to use the try_run() command (
https://cmake.org/cmake/help/latest/command/try_run.html ).

Petr

On 2 June 2016 at 22:10, Ilias Miroslav  wrote:

>
> Greetings, dear experts,
>
>
> we have (two) short Fortran programs (detection of integer*4/8 for math
> libraries) which we would like to build and execute during project's
> configuration phase.
>
>
> There is the " CheckFortranSourceCompiles" command to compile a Fortran
> source code during project's  configure time.  However, we would be glad
> also to execute the resulting a.out binary and check if it passes or
> crashes.
>
>
> Any help, please ? Is there a way to compile/execute short program in the
> configuration  stage of the (big) project ?
>
>
> Yours, Miro
>
> ( CMake co-builder for http://www.diracprogram.org  )
>
>
>
>
> --
>
> 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] Setting a value in a sub-project

2016-05-20 Thread Petr Kmoch
The situation already involves a cache variable, though: `option(abc "cmt"
ON)` is just syntactic sugar for `set(abc ON CACHE BOOL "cmt")`.

Petr

On 20 May 2016 at 13:03, Jakob van Bethlehem 
wrote:

> You don't have to create a cache variable for this. Put yourself in the
> position of CMake;
> * While scanning the CMakeLists.txt of Foo CMake encounters the set(OPT1
> ON FORCE) command, which tells CMake to create a *variable* called OPT1
> with value ON
> * Then CMake is asked to include Bar
> * While scanning Bar, CMake encounters the option() command, so it will
> create an option called OPT1
> * end then nothing, CMake finished scanning
>
> Only the second time around, when CMake encounters the set(OPT1..)
> command, it will have gained knowledge of the presence of the OPT1 option,
> and hence it will realize it needs to change that option instead of
> creating a variable with that name.
>
> So to me, your output is exactly as expected. I suspect if you include Bar
> before setting the option, you will get the behaviour you expected. This,
> to me, makes perfect sense, as Bar is a dependency of Foo, and hence needs
> to be setup before you start setting up Foo. You wouldn't compile Foo
> before compiling Bar, so why would that be different for the configuration
> step.
>
> Sincerely,
> Jakob
>
> On Fri, May 20, 2016 at 11:24 AM, Doug Cuthbertson <
> doug.cuthbert...@gmail.com> wrote:
>
>>
>> CMake (version 3.5.2) surprised me with how it's passing values to
>> sub-projects, so I was wondering if this is expected behavior. Here's an
>> example of what I mean. Let's say I have a project Foo in a directory of
>> the same name. It contains a third-party library called Bar which has a
>> CMakeLists.txt file that looks like:
>>
>> cmake_minimum_required(VERSION 2.8.12)
>>
>> option(OPT1
>>   "Set to OFF|ON (default is OFF) to control build of Bar library"
>> OFF)
>>
>> if(OPT1)
>>   message("Bar: OPT1 is on")
>> else(OPT1)
>>   message("Bar: OPT1 is off")
>> endif(OPT1)
>>
>> I then create CMakeLists.txt for Foo that sets OPT1 to ON and includes
>> Bar:
>>
>> cmake_minimum_required(VERSION 2.8.12)
>>
>> set(OPT1 ON FORCE)
>> if(OPT1)
>>   message("Foo: OPT1 is on")
>> else(OPT1)
>>   message("Foo: OPT1 is off")
>> endif(OPT1)
>> add_subdirectory(Bar)
>>
>> The first time I run cmake the message output is:
>>
>> Foo: OPT1 is on
>> Bar: OPT1 is off
>>
>> If I run cmake again, I get:
>>
>> Foo: OPT1 is on
>> Bar: OPT1 is on
>>
>> If this is expected behavior, is there any way I can ensure Bar receives
>> the value of OPT1 the first time? It makes a huge difference when the
>> option controls, for example, whether a static or dynamic library will be
>> built.
>>
>> Thanks,
>> Doug
>>
>> --
>>
>> 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
>
-- 

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] Setting a value in a sub-project

2016-05-20 Thread Petr Kmoch
Hi Doug,

your syntax for `set()` in Foo is incorrect; you're actually setting a
non-cache variable OPT1 do the value "ON;FORCE".

You want to set the *cache* variable OPT1, which would be done like this:

  set(OPT1 ON CACHE BOOL "Set to OFF|ON (default is OFF) to control build
of Bar library" FORCE)

Petr

On 20 May 2016 at 11:24, Doug Cuthbertson 
wrote:

>
> CMake (version 3.5.2) surprised me with how it's passing values to
> sub-projects, so I was wondering if this is expected behavior. Here's an
> example of what I mean. Let's say I have a project Foo in a directory of
> the same name. It contains a third-party library called Bar which has a
> CMakeLists.txt file that looks like:
>
> cmake_minimum_required(VERSION 2.8.12)
>
> option(OPT1
>   "Set to OFF|ON (default is OFF) to control build of Bar library" OFF)
>
> if(OPT1)
>   message("Bar: OPT1 is on")
> else(OPT1)
>   message("Bar: OPT1 is off")
> endif(OPT1)
>
> I then create CMakeLists.txt for Foo that sets OPT1 to ON and includes Bar:
>
> cmake_minimum_required(VERSION 2.8.12)
>
> set(OPT1 ON FORCE)
> if(OPT1)
>   message("Foo: OPT1 is on")
> else(OPT1)
>   message("Foo: OPT1 is off")
> endif(OPT1)
> add_subdirectory(Bar)
>
> The first time I run cmake the message output is:
>
> Foo: OPT1 is on
> Bar: OPT1 is off
>
> If I run cmake again, I get:
>
> Foo: OPT1 is on
> Bar: OPT1 is on
>
> If this is expected behavior, is there any way I can ensure Bar receives
> the value of OPT1 the first time? It makes a huge difference when the
> option controls, for example, whether a static or dynamic library will be
> built.
>
> Thanks,
> Doug
>
> --
>
> 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-developers] [PATCH] cmFileCommand: sort list of files from glob command

2016-05-16 Thread Petr Kmoch
Hi all.

I'd like to express my concerns about the proposed change. CMake strongly
discourages using `file(GLOB)` to find source files, since file additions
then do not automatically trigger a buildsystem regeneration. So
well-behaved projects, which do not feed such outputs to add_*() commands,
will now pay a performance penalty for a feature only introduced for the
sake of the ill-behaved ones.

In our setup, we have a large CMake-language framework built on top of
"vanilla" CMake (partly for historical reasons, but partly to support our
particular workflow), and we're always struggling with keeping the time of
CMake processing down. Adding unnecessary overhead would be bad news for us.

Can we instead make the feature optional? Even opt-out would be good
enough, even thought there technically already is an opt-in, namely
`list(SORT)` (which is even mentioned in the docs).

Petr

On 14 May 2016 at 12:30, Reiner Herrmann  wrote:

> file(GLOB ...) is often used to find source files. As it uses
> readdir(), the list of files will be unsorted.
> This list is often passed directly to add_executable / add_library.
> Linking binaries with an unsorted list will make it unreproducible,
> which means that the produced binary will differ depending on the
> unpredictable readdir() order.
>
> To solve those reproducibility issues in a lot of programs (which
> don't explicitely sort the list manually), this change sorts the
> resulting list of the file GLOB command.
>
> A more detailed rationale about reproducible builds is available at:
>  https://reproducible-builds.org/
> ---
>  Help/command/file.rst| 3 +--
>  Source/cmFileCommand.cxx | 1 +
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Help/command/file.rst b/Help/command/file.rst
> index 96ac6c7..a502134 100644
> --- a/Help/command/file.rst
> +++ b/Help/command/file.rst
> @@ -103,8 +103,7 @@ Generate a list of files that match the
>  and
>  store it into the .  Globbing expressions are similar to
>  regular expressions, but much simpler.  If ``RELATIVE`` flag is
>  specified, the results will be returned as relative paths to the given
> -path.  No specific order of results is defined.  If order is important
> then
> -sort the list explicitly (e.g. using the :command:`list(SORT)` command).
> +path.  The file list will be sorted.
>
>  By default ``GLOB`` lists directories - directories are omited in result
> if
>  ``LIST_DIRECTORIES`` is set to false.
> diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
> index 6b6b913..4efa550 100644
> --- a/Source/cmFileCommand.cxx
> +++ b/Source/cmFileCommand.cxx
> @@ -1026,6 +1026,7 @@ bool
> cmFileCommand::HandleGlobCommand(std::vector const& args,
>
>  std::vector::size_type cc;
>  std::vector& files = g.GetFiles();
> +std::sort(files.begin(), files.end());
>  for ( cc = 0; cc < files.size(); cc ++ )
>{
>if ( !first )
> --
> 2.8.1
>
> --
>
> 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-developers
>
-- 

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-developers

Re: [CMake] CMake:question of the time when the command will happen in add_custom_command(...)

2016-04-22 Thread Petr Kmoch
No, it is indeed compiled and linked just fine. What I meant is:

Without any custom commands, the build process conceptually looks like this:

buildMain() {
  compile_object_files();
  link_main_binary();

  message("Built target main");
}

With a post-build custom command:

buildMain() {
  compile_object_files();
  link_main_binary();
  post_build_command();

  message("Built target main");
}

The custom command becomes a part of the entire process of "Building
target," that's why the "Built target" message appears after the command
runs.

BTW, please keep the mailing list in copy when replying.

Petr

On 22 April 2016 at 10:02, Chaos Zhang <zcsd2...@gmail.com> wrote:

> So what you mean is the target have not been complied and linked after i 
> introduce
> custom commands into this target right? Do i understand right?
>
> Thanks a lot for your generous help. :-)
>
> 2016-04-22 16:38 GMT+08:00 Petr Kmoch <petr.km...@gmail.com>:
>
>> Hi,
>>
>> the reason is that the post-build command is actually a part of building
>> "main the target." Once you introduce custom commands into a target,
>> building it includes them all, and not just compiling the object files and
>> linking the binary. You will notice that the "Linking C exectuable main"
>> line came before the post-build message, so it did happen in the correct
>> order.
>>
>> Petr
>>
>> On 22 April 2016 at 06:25, Chaos Zhang <zcsd2...@gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> I have some trouble when i use PRE_BUILD | PRE_LINK | POST_BUILD in
>>> command
>>> "add_custom_command(...)". When i use POST_BUILD, i found the command
>>> will
>>> execute before target had been built, like this:
>>>
>>> 1 [root@VM_33_35_centos build]# make
>>> 2 Scanning dependencies of target main
>>> 3 [100%] Building C object CMakeFiles/main.dir/main.c.o
>>> 4 Linking C executable main
>>> 5 This is pre build
>>> 6 This is post build
>>> 7 [100%] Built target main
>>>
>>> In my CMakeLists.txt, the content is:
>>>  1 cmake_minimum_required(VERSION 2.8)
>>>  2 add_executable(main main.c)
>>>  3 add_custom_command(TARGET main
>>>  4 PRE_BUILD
>>>  5 COMMAND echo "This is pre build "
>>>  6 )
>>>  7 add_custom_command(TARGET main
>>>  8 POST_BUILD
>>>  9 COMMAND echo "This is post build"
>>>  10 )
>>>
>>> Why the command echo "This is post build" in 8 line(CMakeLists.txt) did
>>> not
>>> execute after [100%] Built target main in 7 line(Linux command)?
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314.html
>>> Sent from the CMake mailing list archive at Nabble.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
>>>
>>
>>
>
-- 

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:question of the time when the command will happen in add_custom_command(...)

2016-04-22 Thread Petr Kmoch
Hi,

the reason is that the post-build command is actually a part of building
"main the target." Once you introduce custom commands into a target,
building it includes them all, and not just compiling the object files and
linking the binary. You will notice that the "Linking C exectuable main"
line came before the post-build message, so it did happen in the correct
order.

Petr

On 22 April 2016 at 06:25, Chaos Zhang  wrote:

> Hi all,
>
> I have some trouble when i use PRE_BUILD | PRE_LINK | POST_BUILD in command
> "add_custom_command(...)". When i use POST_BUILD, i found the command will
> execute before target had been built, like this:
>
> 1 [root@VM_33_35_centos build]# make
> 2 Scanning dependencies of target main
> 3 [100%] Building C object CMakeFiles/main.dir/main.c.o
> 4 Linking C executable main
> 5 This is pre build
> 6 This is post build
> 7 [100%] Built target main
>
> In my CMakeLists.txt, the content is:
>  1 cmake_minimum_required(VERSION 2.8)
>  2 add_executable(main main.c)
>  3 add_custom_command(TARGET main
>  4 PRE_BUILD
>  5 COMMAND echo "This is pre build "
>  6 )
>  7 add_custom_command(TARGET main
>  8 POST_BUILD
>  9 COMMAND echo "This is post build"
>  10 )
>
> Why the command echo "This is post build" in 8 line(CMakeLists.txt) did not
> execute after [100%] Built target main in 7 line(Linux command)?
>
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314.html
> Sent from the CMake mailing list archive at Nabble.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
>
-- 

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-developers] [CMake] add_custom_command() OUTPUT does not accept generator expressions, why?

2016-04-06 Thread Petr Kmoch
On 6 April 2016 at 09:51, Yves Frederix 
wrote:

> [...]
> So, basically, a prerequisite for the above
> to work is that CMake behaves nicely for the following as well:
>
>   add_library(test_lib STATIC existing_file_$.cpp)
>
> At this moment CMake supports generator expressions in the source
> list, so this "should" work. It does not in practice, however:
>
>   CMake Error in CMakeLists.txt:
> Target "test_target" has source files which vary by configuration.
> This is
> not supported by the "Visual Studio 14 2015" generator.
>
> Intuitively I understand why this is not supported (different
> configurations share the same project file in VS, so which source file
> would the project point to?) Is this also a technical limitation
> though? Or do VS project files (and other multiconfig generator
> project files such as xcode) support this setup but was it merely not
> implemented yet?
>

I don't know anything about XCode, unfortunately. However,  Visual Studio
definitely supports a form of varying the source file list of the project
between configurations. That's because a source file can be marked as
_excluded_ from build for a particular configuration. So the solution CMake
could use would be to add all source files from all configurations into the
project, but mark them as excluded from [in]appropriate configurations.

Petr
-- 

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-developers

Re: [CMake] using cmake to link header files: file could be found, is included, but build error when using nmake.

2016-03-31 Thread Petr Kmoch
Hi Karel,

I've noticed a few points where you could start looking for a solution:

* You're mentioning that CMake warns about some linking stuff, but the
compiler error is one about including a header file. Libraries and headers
are fundamentally different objects: header files are used by the compiler,
libraries are used by the linker.

* Regarding the linking thing:

AVRO_LIBRARY- The Avro C++ libraries

Yet you seem to be setting this to a directory:

set(AVRO_LIBRARY
D:/kuleuven/thesis/kaa/kaaBuild/avro_1.8.0/lang/c++/build.win)

when you're supposed to set it to a library (.lib file).

* As for the header issue, you're setting:

set(AVRO_INCLUDE_DIR
D:/kuleuven/thesis/kaa/kaaBuild/avro_1.8.0/lang/c++/avro)

but then using:

include_directories (
 ${AVRO_INCLUDE_DIRS}
 )

Note the difference in the trailing 'S'.

* Additionally, variables like AVRO_INCLUDE_DIR and AVRO_LIBRARY look like
something the find package should be setting *for* you. It doesn't seem
like a package shipped with CMake, so consult its docs to check you're
using it as intended.

Petr

On Wed, Mar 30, 2016 at 5:15 PM, Karel Geiregat 
wrote:

> Dear users at Cmake
>
>
> It could be that I don't have understood the linking process when building
> the project by cmake. The project has three dependencies: (1) Boost, (2)
> (Apache) Avro and (3) Botan.
> After issuing the following command to be able to use the nmake command
> from Visual Studio:
>
> D:\...\build>cmake -G "NMake Makefiles" -DKAA_INSTALL_PATH="D:\kaa\kaaSDK"
>> -DKAA_DEBUG_ENABLED=1 ..
>>
>
> It ran without problems, except minor warnings like
>
> WARNING: Target "kaacpp" requests linking to directory
>> "D:/kaa/kaaBuild/avro_1.8.0/lang/c++/build.win".  Targets may link only to
>> libraries.  CMake is dropping the item.
>>
> => note: full log is at the bottom of this mail (appendix 1).
>
> but when i call nmake after, it immediately throws up error:
>
> D:\...\build>nmake
>>
>> Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
>> Copyright (C) Microsoft Corporation.  All rights reserved.
>>
>> Scanning dependencies of target kaacpp_o
>> [  1%] Building CXX object
>> CMakeFiles/kaacpp_o.dir/impl/event/registration/EndpointRegistrationManager.cpp.obj
>> EndpointRegistrationManager.cpp
>> D:\kaa\kaa-cpp-ep-sdk-aXrMkhHEE2BrPBehV_Vbxym2MfU\kaa/gen/EndpointGen.hpp(26):
>> fatal error C1083: Cannot open include file: 'avro/Specific.hh': No such
>> file or directory
>> NMAKE : fatal error U1077: 'C:\PROGRA~2\VISUAL~1.0\VC\bin\cl.exe' :
>> return code '0x2'
>> Stop.
>> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Visual Studio
>> 14.0\VC\BIN\nmake.exe"' : return code '0x2'
>> Stop.
>>
>
> I have checked the file, and there is the following includes
>
> #include 
>> #include "boost/any.hpp"
>> #include "avro/Specific.hh" < error line
>> #include "avro/Encoder.hh"
>> #include "avro/Decoder.hh"
>>
>
> My idea is that the linking of the avro library is not set up correctly
> since the error got thrown after including a Boost file.
> Here is a fragment of my cmakelists.txt file where Avro got added and how
> the packages got found/added
>
> #  AVRO_ROOT_DIR   - Set this variable to the root installation
>> of  Avro C++ if the module has problems finding the proper installation
>> path.
>> #  AVRO_LIBRARY- The Avro C++ libraries
>> #  AVRO_INCLUDE_DIR- The location of Avro C++ headers
>> set(AVRO_ROOT_DIR D:/kuleuven/thesis/kaa/kaaBuild/avro_1.8.0/lang/c++)
>> set(AVRO_LIBRARY
>> D:/kuleuven/thesis/kaa/kaaBuild/avro_1.8.0/lang/c++/build.win)
>> set(AVRO_INCLUDE_DIR
>> D:/kuleuven/thesis/kaa/kaaBuild/avro_1.8.0/lang/c++/avro)
>>
>
>>
> some contents omitte
>>
>
>>
> #
>> # Find third-party dependencies
>> #
>> find_package (Boost 1.54 REQUIRED COMPONENTS log system thread)
>> find_package (Avro REQUIRED)
>> find_package (Botan REQUIRED)
>>
> => note: full cmakelist.txt file is added as appendix2
>
>
> After that, i have issued the following messaging
>
> message("--- AVRO: Found? " ${AVRO_FOUND}) <- displays "--- AVRO:
>> Found? TRUE"
>> message(${AVRO_LIBRARIES}) <- displays "
>> D:/kaa/kaaBuild/avro_1.8.0/lang/c++/build.win"
>
>
>
> So, the library can be found. However, it surprises me that the specific
> file, Specific.hh could not be found while it is in the include directory,
> AVRO_INCLUDE_DIR (according to the findavrocpp.cmake
> 
> it's used for headers).
> I have issued the following PowerShell command to show that the file is in
> the given directory
>
> PS D:\kaa\kaaBuild\avro_1.8.0\lang\c++\avro> Get-childitem Specific.hh
>>
>> Directory: D:\kaa\kaaBuild\avro_1.8.0\lang\c++\avro
>>
>> ModeLastWriteTime Length Name
>> - -- 
>> -a 2/9/2012   7:11 PM   7428 

Re: [CMake] File names with unbalanced square brackets

2016-03-19 Thread Petr Kmoch
Hi Allen.

I'm not sure whether it's documented, but CMake interprets square brackets
as escaping the semi-colon character (which means a semi-colon in square
brackets will not work as a list item separator). You will probably have to
translate the file names for CMake processing by replacing [ and ] with a
different string, and replacing it back just before use outside of CMake.

Petr

On Thu, Mar 17, 2016 at 5:38 PM, Allen Barnett 
wrote:

> I inherited a set of files with somewhat unusual file names. In
> particular, there were a couple of files whose names included a single
> square bracket character. I processed these files with the file( GLOB ...)
> command and then iterated over the resulting list with foreach. However,
> the foreach command does not seem to break the resulting list apart
> correctly. To make this concrete, I have a directory with files named "a",
> "b[", and "c". file( GLOB FILES "*" ) returns the list:
>
> /home/allen/test/b[;/home/allen/test/c;/home/allen/test/a
>
> However,
>
> foreach( FILE ${FILES} )
>   message( ${FILE} )
> endforeach()
>
> just prints the same thing. That is, foreach does not split FILES into
> separate pieces. If I rename "b[" to "b]" I see the same behavior. If I
> rename "b[" to "b[]" (or even "b]["), then foreach successfully splits
> FILES into the individual file names.
>
> I'm using CMake 3.3.2. I see the same thing on linux and windows.
>
> Thanks,
> Allen
>
> --
>
> 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-developers] BUG: ALL_BUILD not added to the PREDEFINED_TARGETS_FOLDER

2016-03-15 Thread Petr Kmoch
Hi Taylor,

I am afraid this behaviour is by design, so that ALL_BUILD can be the first
target in the generated solution and thus the Startup project by default.

However (speaking to the wider list audience), I would really appreciate an
option to override this "by design" behaviour. For projects which actually
use the generated solutions in the IDE for development and debugging
(instead of just building it), ALL_BUILD is useless as a startup project
anyway, and it brings an inconsistency to the Solution Explorer (not to
mention the fact that it pushes to the fore a CMake feature which is not
really necessary in VS, irritating "entrenched" Visual Studio users).

Would a patch introducing such an override option be considered acceptable?

Petr

On Mon, Mar 14, 2016 at 8:58 PM, Taylor Braun-Jones 
wrote:

> For the Visual Studio generator, the ALL_BUILD is not added to the
> PREDEFINED_TARGETS_FOLDER ("CMakePredefinedTargets").
>
> Tested on Windows 10 with Visual Studio 2013 using the following
> minimal CMakeLists.txt:
>
> cmake_minimum_required(VERSION 3.5)
> project(foobar)
> set_property(GLOBAL PROPERTY USE_FOLDERS ON)
>
> Targets like ZERO_CHECK, INSTALL, and RUN_TESTS work for me; just not
> ALL_BUILD.
>
> Thanks,
> Taylor
> --
>
> 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-developers
>
-- 

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-developers

Re: [CMake] target_link_libraries from executable

2016-03-10 Thread Petr Kmoch
Hi Gilles,

I don't think you can get rid of this .lib, which is the import library.
Linking in the .exe/.dll world does not use the .exe or .dll file itself as
the item to be linked against, but its import library (.lib) instead. You
cannot link against a .dll if you only have the .dll, you need its import
library. The same holds true for executables.

So if you want to link against a.exe, you need its a.lib import library.

Petr

On Thu, Mar 10, 2016 at 7:04 PM, FOLLIC Gilles 
wrote:

> Hello,
>
>
>
> The idea is to get all the depedencies from an other project (executable).
>
>
>
> set_property(TARGET [EXECUTABLE] PROPERTY ENABLE_EXPORTS true)
>
> target_link_libraries(${PROJECT_NAME} [EXECUTABLE])
>
>
>
> This works perfectly, as I get all the include, libs I need, but I get on
> my
>
> visual studio a new lib from my [EXECUTABLE], called [EXECUTABLE].lib which
>
> I don't need since it is a executable, not a librairy.
>
>
>
> How can I do to remove this lib?
>
>
>
> Thank you
>
>
>
> Gilles
>
>
>
> *
> This message and any attachments (the "message") are confidential,
> intended solely for the addresse(s), and may contain legally privileged
> information.
> Any unauthorized use or dissemination is prohibited. E-mails are
> susceptible to alteration.
> Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall
> be liable for the message if altered, changed or
> falsified.
> Please visit http://swapdisclosure.sgcib.com for important information
> with respect to derivative products.
>   
> Ce message et toutes les pieces jointes (ci-apres le "message") sont
> confidentiels et susceptibles de contenir des informations couvertes
> par le secret professionnel.
> Ce message est etabli a l'intention exclusive de ses destinataires. Toute
> utilisation ou diffusion non autorisee est interdite.
> Tout message electronique est susceptible d'alteration.
> La SOCIETE GENERALE et ses filiales declinent toute responsabilite au
> titre de ce message s'il a ete altere, deforme ou falsifie.
> Veuillez consulter le site http://swapdisclosure.sgcib.com afin de
> recueillir d'importantes informations sur les produits derives.
> *
>
> --
>
> 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] empty list evaluates to false?

2016-02-29 Thread Petr Kmoch
Hi Jan.

No, that's not possible. Internally, CMake does not differentiate between
"list" and "string" in any way. An empty list and an empty string are
indistinguishable. A non-empty string containing N semi-colons is
indistinguishable from a list containing N+1 elements.

Quantum mechanics has wave-particle dualism, CMake has string-list dualism
:-)

Petr

On Mon, Feb 29, 2016 at 3:11 PM,  Jan Hegewald 
wrote:

> Hi cmakers,
> can I create an empty list which evaluates to true? The way I tried they
> evaluate to false:
>
> set(BLAS_LIBRARIES "") # trying to create an empty list
> if(BLAS_LIBRARIES)
> # not called
> endif()
>
> Cheers,
> Jan
> --
>
> 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] cpack generator variable

2016-02-28 Thread Petr Kmoch
Hi Tiago.

If you happen to know the directory for each configuration at CMake
configure time, you could do this:

install(DIRECTORY path/to/Debug/dir
  DESTINATION bin
  CONFIGURATIONS Debug
  COMPONENT files
)

install(DIRECTORY path/to/Release/dir
  DESTINATION bin
  CONFIGURATIONS Release
  COMPONENT files
)

# ...etc

Petr


On Fri, Feb 26, 2016 at 10:40 PM, Tiago Macarios 
wrote:

> Hi All,
>
> I have a cmake project which one of the install targets is a collection of
> files. This files change depending on the configuration (Release,
> Debug...). I would like to be able to install the files like so:
>
> install(DIRECTORY $
> DESTINATION bin
> COMPONENT files)
>
> From the docs I see that cmake does not support that. Generator variables
> do not apply to DIRECTORY. So I was wondering if there is a way to either
> save the directory information somewhere and pass it to cpack afterwards.
>
> So I guess the question is how to pass a variable from cmake to cpack?
>
> Best,
> Tiago
>
>
> --
>
> 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] ExternalProject_Add with flexible install commands

2016-02-25 Thread Petr Kmoch
Hi Kent,

I believe it's not "empty quotes" that disables the install command, it's
the empty string. So you should not escape the quotes:

###
# Default behavior is to NOT install library, empty quotes should disable
install
set( libxxx_inst_comm INSTALL_COMMAND "" )

# Build the library as an external project
  ExternalProject_Add( libxxx
SOURCE_DIR ${PROJECT_SOURCE_DIR}/src
${libxxx_inst_comm}
  )
###

Petr


On Thu, Feb 25, 2016 at 7:04 AM, Knox, Kent  wrote:

> I am having a problem passing parameters as a variable into
> ExternalProject_Add(). I seem to be fighting syntax, i've tried many
> different variants with the set() statement
>
>
> ###
>
> # Default behavior is to NOT install library, empty quotes should disable
> install
> set( libxxx_inst_comm INSTALL_COMMAND "\"\"" )
>
> # Build the library as an external project
>   ExternalProject_Add( libxxx
> SOURCE_DIR ${PROJECT_SOURCE_DIR}/src
> ${libxxx_inst_comm}
>   )
> ###
>
> I get this message, which appears to be within ExternalProject_add()
> using add_custom_command.  Is there a way around this?
>
> CMake Error at
> /opt/homebrew-cask/Caskroom/cmake/3.2.2/CMake.app/Contents/share/cmake-3.2/Modules/ExternalProject.cmake:1487
> (add_custom_command):
>
>   COMMAND may not contain literal quotes:
>
>
> ""
>
>
> --
>
> 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] CheckFortranSourceCompiles alternative for cmake 2.8.12

2016-02-23 Thread Petr Kmoch
Hi Victor,

have a look at the try_compile() command (
https://cmake.org/cmake/help/v2.8.12/cmake.html#command:try_compile ),
especially the second signature (the one which takes SOURCES).

Petr

On Tue, Feb 23, 2016 at 11:56 AM, victor sv  wrote:

> Hi all,
>
> I've seen that in CMake 3.0 appeared the nice CheckFortranSourceCompiles
> feature.
>
> Currently, common SO's like Ubuntu 14 includes CMake 2.8.12.2, but not
> CMake 3.0 or higher. I would like to check if a very small Fortran test
> program compiles using CMake 2.8.12.2, is this possible? how can i do that?
>
> Best regards,
> Víctor.
>
> --
>
> 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] Can't get CMake to use an import library generated from a MODULE target

2016-02-18 Thread Petr Kmoch
Then I would suggest something like

if(CYGWIN)
  set(libType SHARED)
else()
  set(libType MODULE)
endif()

add_library(TheProblematicOne ${libType} ...)

Petr

On Thu, Feb 18, 2016 at 9:59 AM, Sam Habiel  wrote:

> https://cmake.org/cmake/help/v3.0/command/add_library.html
>
> The module library (libgtmshr) is dlopened from the main exe. It's not
> supposed to be linked, except for Cygwin.
>
>
> On Thursday, February 18, 2016, Mueller-Roemer, Johannes Sebastian <
> johannes.sebastian.mueller-roe...@igd.fraunhofer.de> wrote:
>
>> Why are you trying to link a MODULE? The add_library should be changed to
>> SHARED not MODULE.
>>
>> --
>> Johannes S. Mueller-Roemer, MSc
>> Wiss. Mitarbeiter - Interactive Engineering Technologies (IET)
>>
>> Fraunhofer-Institut für Graphische Datenverarbeitung IGD
>> Fraunhoferstr. 5  |  64283 Darmstadt  |  Germany
>> Tel +49 6151 155-606  |  Fax +49 6151 155-139
>> johannes.mueller-roe...@igd.fraunhofer.de  |  www.igd.fraunhofer.de
>>
>>
>> -Original Message-
>> From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Sam Habiel
>> Sent: Thursday, February 18, 2016 09:45
>> To: cmake@cmake.org
>> Subject: [CMake] Can't get CMake to use an import library generated from
>> a MODULE target
>>
>> Rather than email one of the folks at Kitware, I decided to join the
>> CMake mailing list... Hello all for those who remember me.
>>
>> I apologize for the long email.
>>
>> A few of us have been trying to port GT.M
>> (https://www.fisglobal.com/Solutions/Services/Database-Engine) to
>> Cygwin, 1. to get it running on Windows 2. as an exercise to prepare for
>> harder ports, the Raspberry Pi being the holy grail here. That's the
>> background.
>>
>> The problem we are having is familiar to many; but not initially to me.
>> See the heading "Shared libraries with Windows/MinGW" in this
>> article:
>> http://gernotklingler.com/blog/creating-using-shared-libraries-different-compilers-different-operating-systems/
>> .
>>
>> CMakeLists.txt:
>> https://github.com/shabiel/fis-gtm/blob/cygwin/CMakeLists.txt
>>
>> The error:
>> [ 88%] Linking C shared module plugin/cyggtmcrypt_gcrypt_AES256CFB.dll
>> CMakeFiles/libgtmcrypt_gcrypt_AES256CFB.so.dir/sr_unix/gtmcrypt_util.c.o:
>> In function `gc_load_gtmshr_symbols':
>> /home/sam/fis-gtm-cygwin/sr_unix/gtmcrypt_util.c:100: undefined reference
>> to `gtm_malloc'
>> /home/sam/fis-gtm-cygwin/sr_unix/gtmcrypt_util.c:101: undefined reference
>> to `gtm_free'
>> collect2: error: ld returned 1 exit status
>> CMakeFiles/libgtmcrypt_gcrypt_AES256CFB.so.dir/build.make:202: recipe for
>> target 'plugin/cyggtmcrypt_gcrypt_AES256CFB.dll' failed
>> make[2]: *** [plugin/cyggtmcrypt_gcrypt_AES256CFB.dll] Error 1
>> CMakeFiles/Makefile2:891: recipe for target
>> 'CMakeFiles/libgtmcrypt_gcrypt_AES256CFB.so.dir/all' failed
>> make[1]: *** [CMakeFiles/libgtmcrypt_gcrypt_AES256CFB.so.dir/all] Error 2
>> Makefile:116: recipe for target 'all' failed
>> make: *** [all] Error 2
>>
>> Here's the link command (I turned CMAKE_VERBOSE_MAKEFILE=ON):
>> /usr/bin/cc   -march=i586 -fsigned-char -Wmissing-prototypes
>> -Wreturn-type -Wpointer-sign -fno-omit-frame-pointer -g -DDEBUG -shared
>> -Wl,--enable-auto-import -o plugin/cyggtmcrypt_gcrypt_AES256CFB.dll
>> -Wl,--major-image-version,0,--minor-image-version,0
>> CMakeFiles/libgtmcrypt_gcrypt_AES256CFB.so.dir/sr_unix/gtmcrypt_ref.c.o
>> CMakeFiles/libgtmcrypt_gcrypt_AES256CFB.so.dir/sr_unix/gtmcrypt_pk_ref.c.o
>>
>> CMakeFiles/libgtmcrypt_gcrypt_AES256CFB.so.dir/sr_unix/gtmcrypt_dbk_ref.c.o
>>
>> CMakeFiles/libgtmcrypt_gcrypt_AES256CFB.so.dir/sr_unix/gtmcrypt_sym_ref.c.o
>> CMakeFiles/libgtmcrypt_gcrypt_AES256CFB.so.dir/sr_unix/gtmcrypt_util.c.o
>> -lgpg-error -lgpgme -lgcrypt /usr/local/lib/libconfig.dll.a
>>
>> What is missing is that there needs to be either a link to cyggtmshr.dll,
>> or a way for CMake to know to generate a libgtmshr_import.lib and add it to
>> the link command.
>>
>> So here is what I tried:
>> 1. Using the GenerateExportHeader functionality of CMake on libgtmshr.
>> If I do that, it doesn't seem to generate the import library; but it sure
>> does generate an export header, which I don't need. Here it is:
>> include(GenerateExportHeader)
>> generate_export_header(libgtmshr
>> BASE_NAME libgtmshr
>> EXPORT_MACRO_NAME libgtmshr_EXPORTS
>> EXPORT_FILE_NAME  libgtmshr_EXPORTS.h
>> STATIC_DEFINE SHARED_EXPORTS_BUILT_AS_STATIC)
>>
>> 2. Explicitly adding a libgtmshr as a dependency on line
>> https://github.com/shabiel/fis-gtm/blob/cygwin/CMakeLists.txt#L531,
>> but only for Cygwin. I get this error message:
>> CMake Error at CMakeLists.txt:542 (target_link_libraries):
>>   Target "libgtmshr" of type MODULE_LIBRARY may not be linked into another
>>   target.  One may link only to STATIC or SHARED libraries, or to
>> executables
>>   with the ENABLE_EXPORTS property set.
>>
>> The GT.M developer familiar with CMake suggested me to use LINK_FLAGS and
>> have CMake use 

Re: [CMake] compiler independent compiler flags

2016-02-17 Thread Petr Kmoch
Hi.

There is certainly room for providing more, but BUILD_TYPE is not the only
option settable in a compiler-agnostic way. There are target properties:

C_STANDARD
CXX_STANDARD
INCLUDE_DIRECTORIES
INTERPROCEDURAL_OPTIMIZATION
POSITION_INDEPENDENT_CODE
WIN32_EXECUTABLE

and maybe more (I do not claim the list above to be exhaustive).

Petr

On Wed, Feb 17, 2016 at 11:23 AM, Nagy-Egri Máté Ferenc 
wrote:

> Hi Jan,
>
>
>
> Unfortunately, I cannot help you in this regard, though I am surprised how
> little attention this question gained. I too feel that CMake could do
> better both in this regard. While ABI detection is very well done,
> BUILD_TYPE seems to be the only compiler agnostic option available. I do
> not know how to set warning levels for eg. in a compiler agnostic manner.
> Aside from this, there are dozens of other options that are common to all
> C++ compilers and it would rock if I need not look up the exact params for
> all of them.
>
>
>
> Sorry I could not help, but I do feel the struggle.
>
>
>
> Cheers,
>
> Máté
>
>
>
> *Feladó: * Jan Hegewald 
> *Elküldve: *2016. február 5., péntek 11:36
> *Címzett: *cmake@cmake.org
> *Tárgy: *[CMake] compiler independent compiler flags
>
>
>
> Dear all,
>
> do you know a best practice on how to specify compiler flags without
> knowing in advance which compiler will be used?
>
> Its about Fortran projects, where I e.g. want to explicitly enable the
> preprocessor, or make all default real values 8 byte wide. This could be
> done as such:
>
> if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
>
>   set(CMAKE_Fortran_FLAGS "-fpp -r8")
>
> elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
>
>   set(CMAKE_Fortran_FLAGS "-cpp -fdefault-real-8")
>
> endif()
>
>
>
> Cmake has the cmake-compile-features and I though maybe some similar
> mechanism exists for above mentioned compiler switches. So I could say
>
> target_compile_features(mylib PRIVATE f_preprocessor f_real_8)
>
>
>
> Thanks for sharing your advise,
>
> Jan
>
>
>
>
>
> --
>
>
>
> 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
>
-- 

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] Build for x86 architecture through CMake

2016-02-11 Thread Petr Kmoch
Hi Nikita,

x86 is the default. If you use a plain -G "Visual Studio 14 2015" generator
without any architecture, it will generate for x86.

Petr

On Thu, Feb 11, 2016 at 10:34 AM, Nikita Barawade <
nikita.baraw...@einfochips.com> wrote:

>
>
> Hi,
>
> My project needs visual studio solution for x86 architecture.
> I am using windows 10 with VS2015.
>
> When tried to build using CMake command , there is only option for
> selecting Win64 or ARM  but no option for x86.
> After searching a bit came to know that to build for x86 arch ,I need to
> use  "NMake Makefiles " .
>
>
>
> Regards,
> Nikita
> *
> eInfochips Business Disclaimer: This e-mail message and all attachments
> transmitted with it are intended solely for the use of the addressee and
> may contain legally privileged and confidential information. If the reader
> of this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient, you are
> hereby notified that any dissemination, distribution, copying, or other use
> of this message or its attachments is strictly prohibited. If you have
> received this message in error, please notify the sender immediately by
> replying to this message and please delete it from your computer. Any views
> expressed in this message are those of the individual sender unless
> otherwise stated. Company has taken enough precautions to prevent the
> spread of viruses. However the company accepts no liability for any damage
> caused by any virus transmitted by this email.
> *
>
>
> --
>
> 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] Find correct boost among peers

2016-02-08 Thread Petr Kmoch
Hi Scott.

Regarding the delimiters: you'd see them if you included the dereference in
the quotes: "Boost root: ${BOOST_ROOT}". When outside quotes, the
delimiters are effectively swallowed up by message().

Regarding the main issue: I could be wrong, but from a quick glance at the
FindBoost.cmake module, it seems to me that it doesn't expect BOOST_ROOT to
contain more than one path. If it doesn't work for you without these hints,
you will maybe need to pass them in a different form. I cannot suggest one,
though; I am not versed enough in the FindBoost module.

Petr

On Mon, Feb 8, 2016 at 2:10 AM, B. Scott Harper  wrote:

> I have several versions of boost downloaded on my machine inside a
> "thirdparty" directory. Different projects rely on various versions.
>
> I am trying to find a later version than the first version in that
> collection. I have gotten the closest by using a file(GLOB ...) as follows:
>
> file(GLOB BOOST_ROOT ${THIRD_PARTY_DIR}/boost_*)
> find_package(Boost
>   1.60.0
>   REQUIRED)
>
> ...but if I have any versions of Boost earlier than 1.60.0 in this case,
> it will find only the first directory, recognize that it's too early, and
> bail out without trying any other directories.
>
> When I print out the results of the GLOB action using message(STATUS
> "Boost root: " ${BOOST_ROOT}), I don't see any delimiters in the string,
> and I wonder if this it causing the problem? Is this expected beahiour or
> am I using this incorrectly?
>
> Cheers,
> -- Scott
>
> --
>
> 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 env - no command given

2016-02-08 Thread Petr Kmoch
Hi Lars.

No, that's a "bug" in your command-line. In cmd, the caret ^ is used as a
general escape character for escaping spaces, pipes etc. But to escape
quotes, a backslash \ is used (yes, the escaping rules in cmd are weird).
So the backslash preceding the quote is taken by cmd to be an escape
character, and the quote becomes a literal quote character instead of
terminating the argument. You're left without a closing quote, which cmd
apparently auto-fill, so you end up passing the string `PATH=C:\temp" calc`
as one argument, and no other argument.

If you need the backslash before the quote, you need to double it:

"C:\Program Files (x86)\CMake\bin\cmake.exe" -E env "PATH=C:\temp\\" calc

Petr

On Mon, Feb 8, 2016 at 10:02 AM, Lars  wrote:

> Hello,
>
> Using Windows 7 SP1 and cmake 3.3.0
>
> The first command below works (starts calc) when execute in cmd shell. The
> second command produces the error message "cmake -E env: no command given".
> Is this a bug in cmake?
>
> "C:\Program Files (x86)\CMake\bin\cmake.exe" -E env "PATH=C:\temp" calc
> "C:\Program Files (x86)\CMake\bin\cmake.exe" -E env "PATH=C:\temp\" calc
>
>
> regards, Lars
>
> --
>
> 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] Execute command after project generation

2016-02-03 Thread Petr Kmoch
Hi Nicolas.

Last time I asked for something like that, it was rejected:
http://public.kitware.com/Bug/view.php?id=13020

But maybe the stance could change on that? After all, I don't think CMake
would want to cater for every possible postprocessing anyone needs. Perhaps
it could be considered if a big warning "May not be forward compatible" was
attached to it?

Petr

On Fri, Jan 29, 2016 at 8:13 PM, Nicolas Schneider 
wrote:

> Is it possible to execute commands after the generation step of the
> project files?
>
> I want to set custom properties in the generated Visual Studio project,
> because it should be built as a driver, which requires a few extra steps.
> These changes should be done automatically by CMake (or a script run
> after project generation) to be in sync between all developers.
>
> I also tried just setting the properties with something like: cmake
> --build . -- /p:FilesToPackage="a;b;c"
>
> But it seems like CMake does not pass the command as raw string, because
> msbuild complains about non-existing property, like it does when called
> directly without quotes: msbuild project /p:FilesToPackage=a;b;c
> which would treat 'b' as a property key instead of part of the value for
> FilesToPackage.
>
> The only workaround, currently, is to use:
> cmake ..
> modifyProjects.py
> cmake --build .
>
> However, I assume this does not work correctly if CMake regenerates the
> project files because of changes in CMakeLists (because
> modifyProjects.py will not be called automatically by CMake), correct?
> --
>
> 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] Help for a cmake newbie

2016-02-03 Thread Petr Kmoch
Hi Vadtec.

*The* standard CMake way of dealing with building your dependencies is the
ExternalProject module (
https://cmake.org/cmake/help/latest/module/ExternalProject.html ). It's a
huge beast, but I belive there are some examples and tutorials available
out there.

The gist is: you create a top-level, "superbuild" CMakeLists.txt file which
will contain only the uses of ExternalProject_Add, one for each dependency,
and *one for you own project as well.* The dependencies can be downloaded,
patched, builtt, installed, etc., depending on the parameters you pass to
ExternalProject_Add. They do not have to be CMake-based; when they are not,
simply provide an empty (or otherwise project-specific) CONFIGURE_COMMAND
argument.

When CMake is run on the superbuild, it generates a buildsystem such that
building it downloads, builds, installs, etc. the external projects. All of
this happens at build time, not at CMake time.

This way, you have full control over which dependencies you build in what
order, where they get installed etc. Of course, in your case with
dependency sources shipped, you don't need a download step (or perhaps
maybe just to unpack them).

Once you've successfully built the superbuild once, all the dependencies
are ready, and your own project (which you've set up as just another
external project) is configured and all its dependencies are in locations
which you've specified. Now you switch into the binary directory
corresponding to your project and no longer need to work in the superbuild
- each external project is self-contained in that it can be used directly
as well, without having to go through the superbuild.

On a very symbolic level, an external project setup can look something like
this:

root/CMakeLists.txt:
project(SuperBuild)
include(ExternalProject)

ExternalProject_Add(
  LibraryWeNeed
  PREFIX deps/LibraryWeNeed
  DOWNLOAD_COMMAND somehow_unpack
${CMAKE_CURRENT_SOURCE_DIR}/deps/LibraryWeNeed.tgz --into
${CMAKE_CURRENT_BINARY_DIR}/deps/LibraryWeNeed
  BUILD_COMMAND make whatever
  ...
)

ExternalProject_Add(
  MyProjectItself
  PREFIX mybuild
  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src
  DEPENDS LibraryWeNeed
  CMAKE_GENERATOR ${CMAKE_GENERATOR}  # use the same generator as the
superbuild
  CMAKE_CACHE_ARGS
-DLibraryWeNeed_ROOT:PATH=${CMAKE_CURRENT_BINARY_DIR}/deps/LibraryWeNeed
  ...
)


src/CMakeLists.txt:
project(MyProject)
find_package(LibraryWeNeed PATHS ${LibraryWeNeed_ROOT})  # the root path
was passed in by the superbuild
...


To work with this, you would then do:

cd build
cmake ../root  # generates superbuild
make  # builds superbuild
cd mybuild  # go into MyProject's binary dir
make  # builds MyProject


Once more, this is all very symbolic. Please refer to documentation,
tutorials etc. to achieve the behaviour you need.

Petr



On Sun, Jan 31, 2016 at 3:42 AM, vadtec  wrote:

> Let me start by saying I consider my self a cmake newbie. I've made simple
> makefiles and simple cmake files, but anything more complicated has to this
> point eluded me. Not for a lack of trying, searching, researching, trail,
> and a great deal of error: I simply have not been able to achieve the
> things I'm after. If the sort of questions I'm asking have been answered
> elsewhere (as I'm sure they have), I apologize for asking them again. That
> being said, I realize I'm going to be asking some questions that my
> Google-Fu has failed me in answering. Forgive me my failings, but I'm at my
> witts end.
>
>
> I have a project that I'm building on Linux that has a server component
> and a client component that also needs to run on Windows. It uses several
> libraries that I want to version lock so I run into fewer issues with cross
> compiling and feature creep.
>
> The project is laid out like this:
>
> /home
> mydir/
> project/
> build/
> bundle/
> deps/
> curl-7.43.0/
> libiconv-1.14/
> libpng-1.6.18/
> libssh2-1.6.0/
> openssl-1.0.2d/
> sqlite/
> tinycthread/
> zlib-1.2.8/
> include/
> client/
> client.h
> common/
> config.h
> common_funcs.h
> server/
> server.h
> src/
> client/
> client.c
> common/
> common_funcs.c
> server/
> server.c
>
> curl, libiconv, libpng, libssh2, and zlib are the libs I want to build and
> use both on Linux and Windows. I know all of those are available on Linux
> and I could use the system installed versions, but I want to use the same
> vesions on Windows as well. The server is only built on Linux, while the
> client needs to be built for Linux and Windows. All the libs, headers, etc
> go into the build 

Re: [CMake] errors with add_custom_command and add_custom_target

2016-01-26 Thread Petr Kmoch
Normally, you would want to keep your source tree clean from any build-time
modifications (CMake *strongly discourages* in-source builds, with good
reason).
Therefore, you'd want to generate the files in CMAKE_CURRENT_BINARY_DIR.
Assuming the generator always writes them into its current directory, you'd
do this:

set(EXIST_SOURCES A.cc B.cc C.cc)
set(GEN_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/X.cc
${CMAKE_CURRENT_BINARY_DIR}/Y.cc ${CMAKE_CURRENT_BINARY_DIR}/Z.cc)
add_custom_command(OUTPUT ${GEN_SOURCES}
   COMMAND generator
   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
   MAIN_DEPENDENCY gendir/generator)
add_library(mylib OBJECT ${EXIST_SOURCES} ${GEN_SOURCES} )

Petr


On Tue, Jan 26, 2016 at 10:07 AM, Vania Joloboff <vania.jolob...@inria.fr>
wrote:

> Hi Petr,
>
> Thanks, indeed I had unset the property !
> Cmake works fine with removing the line. But I have now a doubt.
> My generator generates the files in the current dir.
> Should I indicate the working directory in add_custom_command ?
> so that the generated sources are added in CMAKE_CURRENT_SOURCE_DIR
> or it will automatically add them in the source dir and not the build dir ?
> Vania
>
>
>
> On 01/26/2016 09:43 AM, Petr Kmoch wrote:
>
>> Hi, Vania.
>>
>> You should remove this line:
>>
>> set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED )
>>
>> CMake will mark the files as generated automatically.
>>
>> What your line is actually doing is setting them as *not* generated,
>> because you didn't pass any argument to set the property to, so it's
>> implicitly unset. What you probably wanted would have been this:
>>
>> set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED TRUE)
>>
>> But again, remove the line altogether, it's unnecessary.
>>
>> You should also remove the quotes from your `add_library` call. The way
>> you have it would look for a single file named "A.cc;B.cc;C.cc
>> X.cc;Y.cc;Z.cc".
>>
>> Petr
>>
>> On Tue, Jan 26, 2016 at 9:36 AM, Vania Joloboff <vania.jolob...@inria.fr
>> <mailto:vania.jolob...@inria.fr>> wrote:
>>
>> Hi
>>
>> I have a generator that generates some, but not all of the source
>> files.
>> My understanding was that I should use add_custom_command for that
>>
>> When I do
>> set(EXIST_SOURCES A.cc B.cc C.cc)
>> set(GEN_SOURCES X.cc Y.cc Z.cc)
>> add_custom_command(OUTPUT ${GEN_SOURCES}
>>COMMAND generator
>>MAIN_DEPENDENCY gendir/generator   )
>> set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED )
>> add_library(mylib OBJECT "${EXIST_SOURCES} ${GEN_SOURCES}" )
>>
>> I get error "Cannot find source file : X.cc"
>>
>> So, I tried
>>
>> set(EXIST_SOURCES A.cc B.cc C.cc)
>> set(GEN_SOURCES X.cc Y.cc Z.cc)
>> add_custom_target(generate
>>   COMMAND generator
>>   COMMENT "Generate"
>>   DEPENDS gendir/generator   )
>> set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED )
>> add_library(mylib OBJECT "${EXIST_SOURCES} ${GEN_SOURCES}" )
>> add_dependencies(mylib generate)
>>
>> I get same error "Cannot find source file : X.cc"
>>
>> I just don't get it...
>>
>> Vania
>>
>> --
>> Powered by www.kitware.com <http://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] errors with add_custom_command and add_custom_target

2016-01-26 Thread Petr Kmoch
Hi, Vania.

You should remove this line:

set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED )

CMake will mark the files as generated automatically.

What your line is actually doing is setting them as *not* generated,
because you didn't pass any argument to set the property to, so it's
implicitly unset. What you probably wanted would have been this:

set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED TRUE)

But again, remove the line altogether, it's unnecessary.

You should also remove the quotes from your `add_library` call. The way you
have it would look for a single file named "A.cc;B.cc;C.cc X.cc;Y.cc;Z.cc".

Petr

On Tue, Jan 26, 2016 at 9:36 AM, Vania Joloboff 
wrote:

> Hi
>
> I have a generator that generates some, but not all of the source files.
> My understanding was that I should use add_custom_command for that
>
> When I do
> set(EXIST_SOURCES A.cc B.cc C.cc)
> set(GEN_SOURCES X.cc Y.cc Z.cc)
> add_custom_command(OUTPUT ${GEN_SOURCES}
>COMMAND generator
>MAIN_DEPENDENCY gendir/generator   )
> set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED )
> add_library(mylib OBJECT "${EXIST_SOURCES} ${GEN_SOURCES}" )
>
> I get error "Cannot find source file : X.cc"
>
> So, I tried
>
> set(EXIST_SOURCES A.cc B.cc C.cc)
> set(GEN_SOURCES X.cc Y.cc Z.cc)
> add_custom_target(generate
>   COMMAND generator
>   COMMENT "Generate"
>   DEPENDS gendir/generator   )
> set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED )
> add_library(mylib OBJECT "${EXIST_SOURCES} ${GEN_SOURCES}" )
> add_dependencies(mylib generate)
>
> I get same error "Cannot find source file : X.cc"
>
> I just don't get it...
>
> Vania
>
> --
>
> 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] add_library object argument question

2016-01-25 Thread Petr Kmoch
Hi,

the name given after the : in the TARGET_OBJECTS generator expression is
the logical (CMake) name of a target. There's no scoping in target names,
they're all at the same global scope. So if you have this:

add_library(A OBJECT ...)

then you will access its objects like this:

add_library(... $ ...)

regardless of whether this happens in the same CMakeList or an entirely
different one (parent, child, sibling, it makes not difference).

Which also means there's no need for progressively going up levels: just
use all the A, B, C, D directly in the toplevel add_library call.

Petr

On Mon, Jan 25, 2016 at 3:34 PM, Vania Joloboff 
wrote:

> Hi
>
> In a library project there are two level of subdirectories that contain
> modules
> to be included into the main library.
> In other words, directory lib contains subdirectories foo and bar
> Subdirectory foo contains A and B.
> Subdirectory bar contains C and D.
> All of the objects from A, B, C and D must belong to the library
>
> I understand I can use at the bottom levels A, B, C, D
>  add_library() with the OBJECT argument
> and I should be able to use add_library() in the top directory
> to collect all of the object files from the subdirectories
>
> add_library(... $ ...)
>
> for each of the sub directories. But the documentation is unclear
> about the naming schema to use. What is the syntax/meaning of some_name ?
>
> add_library(... $ $
> $ $ ...)
>
> Or I need to gather at level foo and bar the objects from bottom layer
> and recursively make them go up one level by one level ?
>
> Thanks
> --
>
> 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] Adding definitions to compile one file ?

2016-01-21 Thread Petr Kmoch
On Thu, Jan 21, 2016 at 3:26 PM, Vania Joloboff <vania.jolob...@inria.fr>
wrote:

> HI Petr
>
> Thanks for the suggestion.
> But this will erase the existing compile definitions, won't it ?
> So may be I should do a get_property first,
> append my new definitions and reset the property ?
> I'll try anyway...
>

This would erase the previous value of the property COMPILE_DEFINITIONS
specified on the source file(s), if you've already provided one for it. But
the globally specified compilation definitions, flags etc. do not get
copied into these per-source properties. Instead, the final command line
used for compiling a source is combined from the global, target, and source
file properties (and relevant variables and other things).

If you really need to append to the property, though, you can use APPEND or
APPEND_STRING arguments before the PROPERTY keyword; refer to CMake docs
for more details.

Petr


>
> Vania
>
> On 01/21/2016 03:21 PM, Petr Kmoch wrote:
>
>> Hi Vania.
>>
>> For your case, it's best to forget about the
>> not-as-convenient-as-they-could-be convenience functions set_*_properties,
>> and just invoke set_property:
>>
>> set_property(
>>   SOURCE source.cpp
>>   PROPERTY COMPILE_DEFINITIONS
>> VAR1=${MY_VAR1} VAR2=${MY_VAR2}
>> )
>>
>> Petr
>>
>> On Thu, Jan 21, 2016 at 3:14 PM, Vania Joloboff <vania.jolob...@inria.fr
>> <mailto:vania.jolob...@inria.fr>> wrote:
>>
>> Hi
>>
>> I want to add two definitions to compile one specific files
>> in addition to the global definitions.
>> I have the following problem. If I use
>>
>> set_source_files_properties(source.cpp
>> PROPERTIES
>> COMPILE_DEFINITIONS VAR1=${MY_VAR1} VAR2=${MY_VAR2} )
>>
>> then I get error message incorrect number of arguments for
>> set_source_files_properties
>>
>> If I put
>> set_source_files_properties(source.cpp
>> PROPERTIES COMPILE_DEFINITIONS "VAR1=${MY_VAR1} VAR2=${MY_VAR2}" )
>>
>> then it generates strangely enough the compile command
>>
>> /usr/bin/c++ -DVAR1="path1 VAR2=path2" ... source.cpp
>>
>> with the double quotes as above, which gives a weird value to VAR1
>> and no value to VAR2
>>
>> If I use twice set_source_files_properties
>> the first one is overwritten by the second
>> and I only get the definition of VAR2
>>
>> What am I supposed to do ?
>>
>> Thankx
>>
>> PS I am using cmake 3.2.2 on Linux Mint.
>>
>> --
>> Powered by www.kitware.com <http://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] Adding definitions to compile one file ?

2016-01-21 Thread Petr Kmoch
Hi Vania.

For your case, it's best to forget about the
not-as-convenient-as-they-could-be convenience functions set_*_properties,
and just invoke set_property:

set_property(
  SOURCE source.cpp
  PROPERTY COMPILE_DEFINITIONS
VAR1=${MY_VAR1} VAR2=${MY_VAR2}
)

Petr

On Thu, Jan 21, 2016 at 3:14 PM, Vania Joloboff 
wrote:

> Hi
>
> I want to add two definitions to compile one specific files
> in addition to the global definitions.
> I have the following problem. If I use
>
> set_source_files_properties(source.cpp
> PROPERTIES
> COMPILE_DEFINITIONS VAR1=${MY_VAR1} VAR2=${MY_VAR2} )
>
> then I get error message incorrect number of arguments for
> set_source_files_properties
>
> If I put
> set_source_files_properties(source.cpp
> PROPERTIES COMPILE_DEFINITIONS "VAR1=${MY_VAR1} VAR2=${MY_VAR2}" )
>
> then it generates strangely enough the compile command
>
> /usr/bin/c++ -DVAR1="path1 VAR2=path2" ... source.cpp
>
> with the double quotes as above, which gives a weird value to VAR1 and no
> value to VAR2
>
> If I use twice set_source_files_properties
> the first one is overwritten by the second
> and I only get the definition of VAR2
>
> What am I supposed to do ?
>
> Thankx
>
> PS I am using cmake 3.2.2 on Linux Mint.
>
> --
>
> 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] How to pass a configuration file to CMake?

2016-01-21 Thread Petr Kmoch
Hi Cedric.

I believe the comment string argument is mandatory in a set(... CACHE), so
it should be something like this:

set(ENABLE_DOWNLOAD True CACHE BOOL "Should download be enabled")
set(GCC_ROOT "/local/cdoucet/gcc/4.9.2/" CACHE PATH "Path to root directory
of GCC installation")

Petr


On Thu, Jan 21, 2016 at 3:43 PM, Cedric Doucet <cedric.dou...@inria.fr>
wrote:

>
>
> Hello,
>
> I do not manage to pass a configuration file to cmake.
>
> I type 'cmake -C ../config.cmake'
>
> where config.cmake belongs to the parent directory and contains these
> lines:
>
> set(ENABLE_DOWNLOAD True CACHE BOOL)
> set(GCC_ROOT "/local/cdoucet/gcc/4.9.2/" CACHE PATH)
>
> I get the following error message but I don't understand why:
>
> loading initial cache file ../config.cmake
> CMake Error at /local/cdoucet/simol/config.cmake:1 (set):
>   set given invalid arguments for CACHE mode.
>
>
> CMake Error at /local/cdoucet/simol/config.cmake:2 (set):
>   set given invalid arguments for CACHE mode.
>
>
> CMake Error: The source directory "/local/cdoucet/simol/config.cmake" is a
> file, not a directory.
>
>
> Do you know how to solve this problem?
>
> - Cedric Doucet <cedric.dou...@inria.fr> a écrit :
> >
>
> Hi Peter!
>
> Thank you very much!
> It seems to be exactly what I want. :)
> I will try to use it.
>
> Cédric
>
> --
>
> *De: *"Petr Kmoch" <petr.km...@gmail.com>
> *À: *"Cedric Doucet" <cedric.dou...@inria.fr>
> *Cc: *cmake@cmake.org
> *Envoyé: *Lundi 21 Décembre 2015 13:25:53
> *Objet: *Re: [CMake] How to pass a configuration file to CMake?
>
> Hi Cedric.
>
> I have never used it myself, but I believe you're looking for CMake's
> command-line option '-C ':
> https://cmake.org/cmake/help/latest/manual/cmake.1.html
>
> Petr
>
> On Mon, Dec 21, 2015 at 1:12 PM, Cedric Doucet <cedric.dou...@inria.fr>
> wrote:
>
>>
>> Hello,
>>
>> I would like to know if it's possible to pass a configuration file to
>> CMake.
>> I have to pass a lot of information to CMake and the resulting command
>> line is very long to type.
>> Would it be possible to create a file containing all needed definitions
>> and pass it to CMake?
>>
>> For exemple, instead of typing
>>
>> cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=/home/me/there -D
>> CMAKE_CXX_COMPILER=/usr/local/gcc/4.9.3/g++
>>
>> would it be possible to create a file containing
>>
>> CMAKE_BUILD_TYPE=Debug
>> CMAKE_INSTALL_PREFIX=/home/me/there
>> CMAKE_CXX_COMPILER=/usr/local/gcc/4.9.3/g++
>>
>> and pass it to CMake?
>>
>> Cédric
>>
>> --
>>
>> >
>>
>> > 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
>
-- 

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] How to pass a configuration file to CMake?

2016-01-21 Thread Petr Kmoch
It looks as if CMake was interpreting the path as both the source directory
and the initial cache file. Perhaps you could help it by adding the path to
source explicitly:

cmake -C ../config.cmake whatever/your/path/to/source/is

Petr

On Thu, Jan 21, 2016 at 4:10 PM, Cedric Doucet <cedric.dou...@inria.fr>
wrote:

>
>
> Hi Petr,
>
> thank you very much for your answer!
>
> Indeed, comment string arguments seem to be mandatory.
> I modified my configuration file like this:
>
> set(ENABLE_DOWNLOAD True CACHE BOOL "Automatic installation of third-party
> libraries")
> set(GCC_ROOT "/local/cdoucet/gcc/4.9.2/" CACHE PATH "Root of GCC")
>
> Now, I get the following error message:
>
> CMake Error: The source directory "/local/cdoucet/simol/config.cmake" is a
> file, not a directory.
>
> I am quite surprised about this message because I thought a file was
> required to the command 'cmake -C'.
>
> Do you have any idea of what I am doing wrong here?
>
> - Petr Kmoch <petr.km...@gmail.com> a écrit :
> >
> Hi Cedric.
>
> I believe the comment string argument is mandatory in a set(... CACHE), so
> it should be something like this:
>
> set(ENABLE_DOWNLOAD True CACHE BOOL "Should download be enabled")
> set(GCC_ROOT "/local/cdoucet/gcc/4.9.2/" CACHE PATH "Path to root
> directory of GCC installation")
>
> Petr
>
>
> On Thu, Jan 21, 2016 at 3:43 PM, Cedric Doucet <cedric.dou...@inria.fr>
> wrote:
>
>>
>>
>> Hello,
>>
>> I do not manage to pass a configuration file to cmake.
>>
>> I type 'cmake -C ../config.cmake'
>>
>> where config.cmake belongs to the parent directory and contains these
>> lines:
>>
>> set(ENABLE_DOWNLOAD True CACHE BOOL)
>> set(GCC_ROOT "/local/cdoucet/gcc/4.9.2/" CACHE PATH)
>>
>> I get the following error message but I don't understand why:
>>
>> loading initial cache file ../config.cmake
>> CMake Error at /local/cdoucet/simol/config.cmake:1 (set):
>>   set given invalid arguments for CACHE mode.
>>
>>
>> CMake Error at /local/cdoucet/simol/config.cmake:2 (set):
>>   set given invalid arguments for CACHE mode.
>>
>>
>> CMake Error: The source directory "/local/cdoucet/simol/config.cmake" is
>> a file, not a directory.
>>
>>
>> Do you know how to solve this problem?
>>
>> - Cedric Doucet <cedric.dou...@inria.fr> a écrit :
>> >
>>
>> Hi Peter!
>>
>> Thank you very much!
>> It seems to be exactly what I want. :)
>> I will try to use it.
>>
>> Cédric
>>
>> --
>>
>> *De: *"Petr Kmoch" <petr.km...@gmail.com>
>> *À: *"Cedric Doucet" <cedric.dou...@inria.fr>
>> *Cc: *cmake@cmake.org
>> *Envoyé: *Lundi 21 Décembre 2015 13:25:53
>> *Objet: *Re: [CMake] How to pass a configuration file to CMake?
>>
>> Hi Cedric.
>>
>> I have never used it myself, but I believe you're looking for CMake's
>> command-line option '-C ':
>> https://cmake.org/cmake/help/latest/manual/cmake.1.html
>>
>> Petr
>>
>> On Mon, Dec 21, 2015 at 1:12 PM, Cedric Doucet <cedric.dou...@inria.fr>
>> wrote:
>>
>>>
>>> Hello,
>>>
>>> I would like to know if it's possible to pass a configuration file to
>>> CMake.
>>> I have to pass a lot of information to CMake and the resulting command
>>> line is very long to type.
>>> Would it be possible to create a file containing all needed definitions
>>> and pass it to CMake?
>>>
>>> For exemple, instead of typing
>>>
>>> cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=/home/me/there
>>> -D CMAKE_CXX_COMPILER=/usr/local/gcc/4.9.3/g++
>>>
>>> would it be possible to create a file containing
>>>
>>> CMAKE_BUILD_TYPE=Debug
>>> CMAKE_INSTALL_PREFIX=/home/me/there
>>> CMAKE_CXX_COMPILER=/usr/local/gcc/4.9.3/g++
>>>
>>> and pass it to CMake?
>>>
>>> Cédric
>>>
>>> --
>>>
>>> >
>>>
>>> > 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 offer

Re: [CMake] using macros

2016-01-14 Thread Petr Kmoch
Hi Owen.

As a sanity check, the definition of the macro in the toplevel CMakeList
comes *before* the add_subdirectory() command for the one which errors out,
right?

Petr

On Thu, Jan 14, 2016 at 8:25 AM, Owen Hogarth II 
wrote:

> I am trying to use a macro to enable c99 in some of my cmake modules.
>
> In the top level cmake file I add this macro
>
> macro(use_c99)
>   if (CMAKE_VERSION VERSION_LESS "3.1")
> if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
>   set (CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}")
> endif ()
>   else ()
> set (CMAKE_C_STANDARD 99)
>   endif ()
> endmacro(use_c99)
>
> then in another CMakeLists.txt file I add
> use_c99()
>
> but I get this error:
>
> CMake Error at source/internal_src/cube/CMakeLists.txt:1 (use_c
> 99):
>   Unknown CMake command "use_c99".
>
> why am I unable to use the macro? My main cmake is using 3.0.2 from debian
> repository.
>
>
> --
>
> 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] finding if feature is supported by host

2016-01-14 Thread Petr Kmoch
Hi Vania.

A quick look a CMake docs will show you CMake's try_compile() command:
https://cmake.org/cmake/help/latest/command/try_compile.html
(There is also a try_run(), if required).

I believe that's precisely what you want.

Petr

On Thu, Jan 14, 2016 at 5:44 PM, Vania Joloboff 
wrote:

> Hi
>
> I can find if an include file exists with CHECK_INCLUDE_FILE
> But I want to know if a particular feature is supported
> in our case we need to know if the mmap call exists
> and whether it supports the MAP_ANONYMOUS feature
> With autoconf, I can use AC_TRY_COMPILE to try compiling
> a program using the feature.
> Is there some equivalent in cmake ?
>
> Or I have to build my own TRY_COMPILE command to check if a feature
> is supported by a particular function call ?
>
> Thanks
>
>
> --
>
> 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-developers] CMake alternative language (was: Using CMake as a library from Python)

2016-01-11 Thread Petr Kmoch
Hi all.

I'd like to voice my opinion as a somewhat advanced CMake user here.

For me, one of the strongest points of CMake is the fact that its project
specification is procedural rather than declarative. In my current job, for
example, we have a significant framework built in CMake which handles a lot
of unique setups we have (which were largely inherited from a previous
inhouse buildsystem). Yes, the end result of our framework is that the
CMakeLists consist mostly of declarative commands from our framework, but
the implementation of these commands is heavily procedural. I am convinced
that if CMake didn't give us the procedural power required to make this
work, we couldn't have adopted it. (I had previously tried emulating bits
of this setup in a more declarative system and failed miserably).

Of course (having written much of this framework I'm talking about above),
I know all too well that a better front-end language would do a world of
good for CMake. I also understand that taking a more declarative approach
could help that, and I'm not opposed to such a change in principle.
However, please take care not to throw the baby out with the bathwater and
nerf the expressiveness of what can be done with CMake (in a procedural
way).

If I understand Brad's suggestion correctly, it would amount to a (possibly
empty) procedural step being used to generate a declarative description of
the buildsystem. This would work well in our scenario, I believe, as long
as that procedural step could be sufficiently modularised on the client
side.

I fully support introducing an alternative input language to CMake and
taking all steps necessary for this to happen, but please do this in a way
which will not restrict what CMake is capable of doing.

Petr

On Fri, Jan 8, 2016 at 5:30 PM, Brad King  wrote:

> Hi Charles,
>
> Thanks for your efforts in exploring this topic.  CMake's current language
> grew incrementally out of something that was not originally intended as a
> programming language.  The cmState refactoring Stephen Kelly has started
> is a huge step toward enabling alternative languages, but there is a long
> way to go.
>
> A few general thoughts:
>
> * One rule we have for CMake is to never expose any public SDK of the C++
>   implementation structures.  We want to be able to rewrite them
> arbitrarily
>   at any time.  Therefore any solution that needs to access the C++
>   structures must be integrated into CMake upstream and expose
> functionality
>   only through other languages or file formats.
>
> * The cmState infrastructure builds on a "snapshot" design with a goal of
>   being able to "fork" configuration/generation temporarily and then revert
>   back, and to be able to re-start configuration from the middle.  These
>   goals may be incompatible with any language whose implementation we do
>   not fully control unless it is allowed to execute only in isolated and
>   independent snippets.  These are not hard goals, but it is a trade-off
>   to keep in mind.  Stephen may be able to elaborate more on the snapshot
>   approach if needed.
>
> * A problem with the current design is that the entire configuration
> process
>   is logically serial making parallel evaluation hard or impossible.  In
>   many cases each add_subdirectory can be processed independently, but this
>   will require semantic changes to allow.
>
> On 01/04/2016 02:41 AM, Charles Huet wrote:
> > I'm trying to be as declarative as possible, because really like how
> readable
> > simple QML programs are, and I think it would be perfect for a
> buildsystem.
>
> Ideally most of the specification (sources, libraries, executables, etc.)
> should be in a pure format that can be evaluated without side effects (e.g.
> declarative or functional).  This rules out both Python and Lua, but the
> specification format does not have to be the main entry point.  There could
> be some imperative configuration step that does system introspection and
> then loads the pure specification and evaluates it as needed for the
> specific
> environment.
>
> If we're going to go through the effort to provide an alternative input
> format,
> I think we should strive for this approach because it will be more
> flexible in
> the long run.  A pure specification format will allow easy loading/saving
> by
> other tools, IDEs, etc., without having to process any imperative logic.
>
> > Actually, I'm directly using the cmMakefile, because I did not want to
> wrap all
> > the commands, and it seemed backwards to me to wrap them.
>
> Yes.  Any alternative format should be processed directly into the
> structures
> used by the generators.  The cmState work has separated the generate-time
> representation quite a bit from the configuration-time
> (cmake-language-specific)
> representation, but I think there is still further work needed to finish
> that.
>
> >> Having said all that, Brad favors Lua I believe, and he favors a
> different
> >> approach 

Re: [cmake-developers] Profile Cmake scripts

2016-01-05 Thread Petr Kmoch
On Tue, Jan 5, 2016 at 1:33 PM, Daniel Pfeifer 
wrote:

>
> Generators for Xcode and Visual Studio have to generate more files.
>

... and they have to process all configurations (Debug, Release,
MinSizeRel, RelWithDbgInfo) during the generation stage, instead of just
one being processed for single-config generators like Makefiles or Ninja.

Petr
-- 

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-developers

Re: [CMake] change add_executable to add_library leads to an error

2015-12-23 Thread Petr Kmoch
Hi Cedric.

add_custom_target() does not work the way you think it does. The arguments
given after the target name are commands which the custom target will
execute. So what your custom target `statphys` does is execute a program
named `simol-statphys`. When `simol-statphys` was the name of an executable
target, CMake figured out a dependency based on this and arranged it so
that `simol-statphys` is built first and then executed.

However, when `simol-statphys` is a library target, it does not receive
this special treatment; and why would it, since you cannot execute a
library. Therefore, it simply tries to execute a program named
`simol-statphys` and, expectedly, fails.

If I understand your intention with the custom target correctly, you want
to have a shorthand alias for the target in the makefile. The correct
syntax to achieve that would be:

 add_custom_target(statphys)
 add_dependencies(statphys simol-statphys)

Hope this helps.

Petr

On Wed, Dec 23, 2015 at 2:26 PM, Cedric Doucet 
wrote:

>
> Hello,
>
> I have the following script:
> =
>
> file(GLOB_RECURSE statphys "*.cpp")
>
>
> #add_library(simol-statphys SHARED ${statphys})
> add_executable(simol-statphys ${statphys})
>
>
> add_dependencies(simol-statphys simol-core)
>
> add_custom_target(statphys simol-statphys)
>
>
> target_link_libraries(simol-statphys simol-core)
>
> target_link_libraries(simol-statphys
> ${ARMADILLO_INSTALL_DIR}/lib/libarmadillo.so)
> target_link_libraries(simol-statphys
> ${YAMLCPP_INSTALL_DIR}/lib/libyaml-cpp.a)
>
> =
>
>
> I would like generate a shared library simol-statphys instead of an
> executable simol-statphys.
>
> In other words, I would like to replace the call to add_executable, to the
> one which is contained in the comment below this call.
>
>
> However, if I do this, and I type
>
>
> make statphys
>
>
> I get the following error message:
>
>
> Scanning dependencies of target statphys
> /bin/sh: 1: simol-statphys: not found
> make[3]: *** [src/modules/statphys/CMakeFiles/statphys] Erreur 127
> make[2]: *** [src/modules/statphys/CMakeFiles/statphys.dir/all] Erreur 2
> make[1]: *** [src/modules/statphys/CMakeFiles/statphys.dir/rule] Erreur 2
> make: *** [statphys] Erreur 2
>
>
> Does someone can explain me where do the problem come from?
>
>
> Cédric
>
>
> --
>
> 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] How to pass a configuration file to CMake?

2015-12-21 Thread Petr Kmoch
Hi Cedric.

I have never used it myself, but I believe you're looking for CMake's
command-line option '-C ':
https://cmake.org/cmake/help/latest/manual/cmake.1.html

Petr

On Mon, Dec 21, 2015 at 1:12 PM, Cedric Doucet 
wrote:

>
> Hello,
>
> I would like to know if it's possible to pass a configuration file to
> CMake.
> I have to pass a lot of information to CMake and the resulting command
> line is very long to type.
> Would it be possible to create a file containing all needed definitions
> and pass it to CMake?
>
> For exemple, instead of typing
>
> cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=/home/me/there -D
> CMAKE_CXX_COMPILER=/usr/local/gcc/4.9.3/g++
>
> would it be possible to create a file containing
>
> CMAKE_BUILD_TYPE=Debug
> CMAKE_INSTALL_PREFIX=/home/me/there
> CMAKE_CXX_COMPILER=/usr/local/gcc/4.9.3/g++
>
> and pass it to CMake?
>
> Cédric
>
> --
>
> 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] transitive dependencies (again)

2015-12-14 Thread Petr Kmoch
Hi Tom,

linking the static archive into the DLL should not be done by
add_dependencies(), but by target_link_libraries(). There, you can
explicitly list the archive as PRIVATE so that it does not become a part of
the linking interface of the DLL:

add_library(staticArchive STATIC ...)

add_library(theDLL SHARED ...)

target_link_libraries(theDLL PRIVATE staticArchive)

Petr

On Mon, Dec 14, 2015 at 3:34 PM, Tom Kacvinsky  wrote:

> I am getting link errors because cmake is adding transitive
> dependencies.  I am building a DLL which depends on a static archive
> (and is marked as such with add_dependencies), but when I link an
> executable that depends on the DLL, both libraries (import library for
> the DLL and static archive) are specified on the link. leading to
> duplicate symbol errors as the symbol are exported form the DLL and
> defined in the static archive.
>
> How do I work around this?  This is the one thing that has frustrated
> me over the last couple of years - I have never received an answer
> telling me how to turn off transitive dependencies.
>
> Sorry for the minor rant.
>
> Regards,
>
> Tom
> --
>
> 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 target_link_libraries items should be quoted or not? Linux/Ubuntu 14.04 cmake 3.4.1

2015-12-10 Thread Petr Kmoch
Hi,

yes, that is indeed expected behaviour. target_link_libraries() takes a
CMake list of arguments - one library per argument. When you surround the
thing with quotes, it's a single argument (containing some spaces). So for
this call:

target_link_libraries(Debug "${VTK_LIBRARIES} -lsri-spatialfft
-lsri-spatial -lsri-memory")

CMake will instruct the linker to look for a library named " -sri-spatialfft -lsri-spatial -lsri-memory" (one file name
with spaces and semicolons in it). Since such a library does not exist,
that fails.

Without the quotes, each element of the list VTK_LIBRARIES will be a
separate argument to target_link_libraries, as will "-lsri-spatialfft",
"-lsri-spatial", and "-lsri-memory".

Side note: you probably shouldn't be using the -l prefix with arguments to
target_link_libraries(). The arguments are normally supposed to be either
CMake target names, or full paths to the libraries you want to link. No
need to prefix them with linker command-line options, CMake does that for
you accordingly.

Petr

On Wed, Dec 9, 2015 at 6:22 PM, Normand Robert <
normand.rob...@sri.utoronto.ca> wrote:

> robert@kalymnos:~/Code/Debug/normandBuild$ cmake --version
> cmake version 3.4.1
>
> Reading docs trying to understand why my build works when I write
>
> target_link_libraries(Debug ${VTK_LIBRARIES} -lsri-spatialfft
> -lsri-spatial -lsri-memory)
>
> but not when everything is protected in quotes:
>
> target_link_libraries(Debug "${VTK_LIBRARIES} -lsri-spatialfft
> -lsri-spatial -lsri-memory")
>
> which causes an extra library which does not exist to be passed to the
> linker. Is this expected behaviour?
>
> --
> Normand Robert PhD
> Sunnybrook Health Sciences Centre
> Room S632, 2075 Bayview Avenue, Toronto, ON M4N 3M5
>
> --
>
> 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-developers] Obtaining header file dependencies of a source file manually

2015-11-30 Thread Petr Kmoch
Hi Dan,

you could look into the IMPLICIT_DEPENDS argument of add_custom_command:
https://cmake.org/cmake/help/latest/command/add_custom_command.html

I don't have direct experience with it, but it looks like it could do what
you're looking for.

Petr

On Sun, Nov 29, 2015 at 10:47 AM, Dan Liew  wrote:

> Hi,
>
> # TL;DR
>
> I need a way of determining the header file dependencies of a source
> file and inform CMake about them. CMake doesn't do this automatically
> because I'm using custom commands for the compilation step so CMake
> doesn't do it's usual magic of automatically inferring source file
> header dependencies. This is because this part of the compilation step
> requires a separate C++ compiler (completely independent from the one
> that CMake detects at configure time).
>
> Is there a way of doing this that will also regenerate the
> dependencies if the source file changes?
>
> # Long version
>
> A C++ project that I work on [1] is (amongst other things) a compiler.
> In order to compile applications it needs to link in a supporting
> runtime that is compiled to LLVM bitcode which is linked into the
> applications it compiles.
>
> The supporting runtime is written in C++ and compiled with Clang. The
> compilation of the runtime is currently achieved using
> ``add_custom_command()`` and so I am not using CMake's in built
> support for detecting header file dependencies. The reason for doing
> it this way is because the LLVM bitcode compiler (i.e. Clang) **is
> not** the same compiler as the host C++ compiler for the project. For
> example the host code might be built with MSVC but the supporting
> runtime is **always** built with Clang.
>
> To see this concretely take a look at [2].
>
> The build works correctly if you build from a clean build directory.
> It does not work correctly if you perform a rebuild and change one of
> the header files that the supporting runtime depends on. This is
> because CMake doesn't know that the runtime source files depend on the
> header files and so doesn't rebuild the relevant source files.
>
> I can obviously tell CMake about these manually (adding more entries
> under ``DEPENDS`` in the ``add_custom_command()`` invocation) but this
> is very cumbersome.
>
> What I really need is a way to
>
> * Automatically infer the dependencies of a source file and tell CMake
> about them
> * Have the dependencies automatically regenerated if the source file
> changes (someone could add or remove a header file include).
>
> In a simple Makefile build system this typically achieved by doing
> something like this:
>
> ```
> all:: $(SRCS:.cpp:.o)
>
> SRCS := foo.cpp bar.cpp
>
> # Include SRC file dependencies generated by the compiler if they exist
> -include $(SRCs:.cpp=.d)
>
> %.o : %.cpp
>   $(CXX) -c $< -o $@ -MP -MMD -MF $*.d
> ```
>
> Note the ``-M*`` flags get the compiler when it runs to generate
> additional makefile rules that will get included next time a build
> happens.
>
> I don't really know how to do the same thing with CMake. One idea is
> at configure time invoke Clang with the ``-MP -MMD -MF`` flags on each
> runtime source file, extract the dependencies then pass them to
> ``DEPENDS`` in ``add_custom_command()``. If I wanted the dependencies
> regenerated if the runtime source file changes then I would need to
> somehow get CMake to reconfigure every time this happens.
>
> I don't like this idea very much due to
>
> * Having to invoke Clang manually to determine the dependencies. CMake
> already knows how to determine source file dependencies, but this
> functionality (AFAIK) isn't exposed to me.
>
> * Reconfiguring every time one of the runtime source file changes is
> annoying (configuring can be slow sometimes).
>
> Does anyone have any other ideas? CMake obviously knows how to do all
> this stuff already for source files being compiled for the detected
> host C++ compiler, I just don't know how to get at this logic for
> source files that need to be built with a second independent C++
> compiler.
>
> [1] https://github.com/halide/Halide
> [2] https://github.com/halide/Halide/blob/master/src/CMakeLists.txt#L140
>
> Thanks,
> Dan.
> --
>
> 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-developers
>
-- 

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 

Re: [CMake] [cmake-developers] Obtaining header file dependencies of a source file manually

2015-11-30 Thread Petr Kmoch
On Mon, Nov 30, 2015 at 2:04 PM, iosif neitzke <
iosif.neitzke+cm...@gmail.com> wrote:

> What does output_required_files() [0] do, and is it applicable here?
>
> [0] https://cmake.org/cmake/help/v3.4/command/output_required_files.html


First and foremost, it introduces deprecated behaviour into your code. The
very first line in the docs you link to says that it was deprecated in
CMake 3.0 and is this scheduled for removal. It should not be used in new
code.

Petr
-- 

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] Visual Studio .sln post generate modifications?

2015-11-27 Thread Petr Kmoch
Hi.

I don't know how exactly the Deploy checkbox value is stored inside the
.sln file, but CMake has built-in ways of adding arbitrary sections and
contents to the .sln file; see directory properties
VS_GLOBAL_SECTION_PRE_ (
https://cmake.org/cmake/help/latest/prop_dir/VS_GLOBAL_SECTION_PRE_section.html
) and VS_GLOBAL_SECTION_POST_ (
https://cmake.org/cmake/help/latest/prop_dir/VS_GLOBAL_SECTION_POST_section.html
). Perhaps you could use them to store the information in the .sln?

Petr

On Fri, Nov 27, 2015 at 4:24 PM, Tilman Skobowsky 
wrote:

> Hi,
>
> we currently use CMake 3.3.x (x >= 2) on a C++ source code with Windows
> target only.
> In our company we're exclusively using Visual Studio (Version 2015 right
> now).
>
> Since we're using remote debugging we have the following problem:
>
> In order to set up Remote Debugging with VS, you have to edit the settings
> in the "Debugging" pane of the target prefs (a.k.a add_executable()
> target). These debugger settings are stored in a ".vcxproj.user" file,
> which is perfect, because these files don't get touched by the cmake
> generator.
>
> However, in order to automatically deploy the target, one also has to set
> the "Deploy" checkmark in the "Configuration Manager" settings.
> Unfortunately, this setting is NOT saved in a user speciffic file. Instead
> it is saved in the main projects ".sln" file. (Thanks MS...).
>
> I just downloaded the 'cmake' sources to check how the section where this
> information goes is generated. For WinCE builds there is already code that
> emits the right information into the solution file.
>
> Now the best solution (for me) would be to add a target property that
> controls emiting this options. But I guess, this might not be an option
> that could be returned to the 'cmake' source tree, although I'd be willing
> to give it a try. (some info/references/pointers on how to do this are
> welcome)
>
> Second best solution would be a script or mechanism that can post process
> the SLN file after it has been generated by cmake but FROM WITHIN the
> configure/generate process. Is that possible in any way?
>
> Of course I know, that I could write some script in order to tweak the
> solution file after cmake is called, but I'd like to avoid this. I already
> made lot of use of additional options to shown up within CMakeGUI (which is
> really cool) and I'd like to be able to set some  "ENABLE_REMOTE_DEBUGGING"
> switch of some sort so that this can be configured in one place.
>
> TIA
> skybow
>
>
>
>
>
> --
>
> 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] find module configuration not found

2015-11-03 Thread Petr Kmoch
Hi Owen,

the find module which comes with CMake is called FindOpenGL, and is
supposed to be used as:

find_package(OpenGL ...)

Note the case. From the error messages, it seems you're calling
find_package(OPENGL). This could work on a case-insensitive system (which I
believe Mac OS X uses by default), but would definitely not work on a
case-sensitive one such as normal Linux filesystems.

Petr

On Tue, Nov 3, 2015 at 2:11 PM, Owen Alanzo Hogarth 
wrote:

> I just ran into some difficulties.
>
> I migrated a development system to debian 8.
>
> I had a project on mac os x that built w/ no problems now I am running my
> cmake but I get this error:
>
> CMake Error at CMakeLists.txt:4 (FIND_PACKAGE):
>   By not providing "FindOPENGL.cmake" in CMAKE_MODULE_PATH this project has
>   asked CMake to find a package configuration file provided by "OPENGL",
> but
>   CMake did not find one.
>
>   Could not find a package configuration file provided by "OPENGL" with any
>   of the following names:
>
> OPENGLConfig.cmake
> opengl-config.cmake
>
>   Add the installation prefix of "OPENGL" to CMAKE_PREFIX_PATH or set
>   "OPENGL_DIR" to a directory containing one of the above files.  If
> "OPENGL"
>   provides a separate development package or SDK, be sure it has been
>   installed.
>
>
> -- Configuring incomplete, errors occurred!
>
> now it seems finding opengl was a deffault config file on mac os x but not
> so on linux.
>
> I have cmake 3.0.2-1 installed.
>
>
> --
>
> 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] C++11 flag not being added

2015-10-16 Thread Petr Kmoch
Hi Petr.

You're using a feature (`CMAKE_CXX_STANDARD`) introduced in CMake version
3.1, so you should require a minimum version >= that.

You can learn the version of CMake by running `cmake --version`

Petr

On Thu, Oct 15, 2015 at 5:45 PM, Petr Bena  wrote:

> What do you mean by "target" property? I don't see any target
> mentioned there. I don't have this line in there. I don't know which
> CMake this is, it failed on server we use for unit tests, but I have
> required min. version set to 2.8.7
>
>
>
> On Thu, Oct 15, 2015 at 5:41 PM, Matthew S Wallace
>  wrote:
> > What version of CMake are you using?  I’m using 3.3.2.  The only other
> thing I did was:
> >
> > set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED)
> >
> > I’m guessing this probably does nothing since it is probably a target
> property.
> >
> > -Matt
> >
> >> On Oct 15, 2015, at 10:34 AM, Petr Bena  wrote:
> >>
> >> Can you elaborate on it a bit?
> >>
> >> I put set(CMAKE_CXX_STANDARD 11) as first line of my CMakeLists and it
> >> still doesn't work, without the hack I used I get errors while
> >> compiling.
> >>
> >> Can you give me example file in which it works? I guess there is more
> >> needed for it to work.
> >>
> >> On Tue, Oct 13, 2015 at 7:12 PM, Matthew S Wallace
> >>  wrote:
> >>> Thanks, setting the global variable solved my issue.
> >>>
> >>> -Matt
> >>>
>  On Oct 13, 2015, at 10:46 AM, Johannes Zarl-Zierl <
> johannes.zarl-zi...@jku.at> wrote:
> 
>  Hi,
> 
>  CXX_STANDARD is a target property, not a global one. You can either
> set
>  CXX_STANDARD for every target that needs it, or set it globally by
> changing
>  the default value.
> 
>  You can do the latter by setting the variable CMAKE_CXX_STANDARD
> before
>  defining any target that depends on it:
> 
>  set(CMAKE_CXX_STANDARD 11)
> 
>  HTH,
>  Johannes
> 
>  On Tuesday 13 October 2015 10:22:36 Matthew S Wallace wrote:
> > I have the following two lines in my CMakeLists.txt
> >
> > set_property(GLOBAL PROPERTY CXX_STANDARD 11)
> > set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED)
> >
> > However when compiling some of my source files, the -std=c++11 flag
> is not
> > added.
> >
> > Just for good measure I added:
> > target_compile_features(my_target PRIVATE cxx_strong_enums) to the
> target
> > that was having the problem.
> >
> > Not sure if it matters, but in this case the compile error I’m
> getting is
> > complaining because I’m referencing a fully scoped enum.  If I
> explicitly
> > include -std=c++11 in my compile flags, everything works.
> >
> > I’m thinking I’m probably just misunderstanding how CXX_STANDARD
> works, but
> > any help would be appreciated.
> >
> > -Matt
> 
>  --
> 
>  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
> >
> --
>
> 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:
> 

Re: [CMake] "Pre-configure" step in CMake

2015-09-24 Thread Petr Kmoch
Hi Matthaus,

do you need the pre-configure step to happen at build time? Would it be an
option for you to use file(WRITE) instead of configure_file(), and
execute_process() instead of add_custom_target()? Basically, perform the
pre-configure step as part of the first CMake run itself.

Alternatively, you could look into the ExternalProject module, which is (I
believe) designed for situations like yours:
http://cmake.org/cmake/help/v3.3/module/ExternalProject.html

The basic idea of ExternalProject is that you create one top-level,
"SuperBuild" project, which will include each dependency as an external
project, and your real project *as an external project too.* That way, you
can easily gather all dependencies by building the "SuperBuild". Then you
switch to working just with your own project inside the SuperBuild
structure, but all the dependencies are already there.

(Note: I've never used ExternalProject myself, this info comes from what
I've learned on this mailing list from other people using it).

Hope this helps,

Petr

On Wed, Sep 23, 2015 at 9:49 PM, Matthäus G. Chajdas 
wrote:

> Hi,
>
> I'm trying to solve the following the problem: I have a C++ application
> and a dependency fetching script. I want to simplify the initial build
> such that the following happens: On the first run of cmake, the compiler
> ID and version is passed to an external script, which fetches some
> pre-build binaries. It then writes a CMake file which contains basically
> only set(FOO_INCLUDE_DIR /dep-dir), set(FOO_LIBRARY_DIR /dep-dir)
> commands. CMake would then read this file and subsequent find_library
> calls would pick up the values from this new CMake file. The idea is
> that "actual" build is dependent on this first dependency step, but it's
> already within the CMake framework so I can grab the compiler info and
> other build info.
>
> The obvious problem is that while I can easily run the external script
> by using configure_file, and have a custom target that does the
> dependency fetching and CMake configure file generation. But I don't see
> an easy way to get CMake to make the "rest of the project" depend on
> that configure file. How can I make such a "two-stage" build with CMake?
>
> Cheers,
>   Matthäus
> --
>
> 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] How to do that w/o LOCATION property of a target...

2015-09-05 Thread Petr Kmoch
Hi Alex.

I don't know if there is a better solution, but the following workaround
should work for you:

In your normal CMakeList, do `file(GENERATE OUTPUT location.cmake CONTENT
"set(TheLocation \"$\")\n")`.
Then, in the configured *.cmake script, do `include(location.cmake)`. The
location of the target will then be stored in the variable `TheLocation`.

Alternatively, generate just the location and use `file(READ)` instead of
`include()`, whichever suits you better.

Petr

On Sat, Sep 5, 2015 at 8:22 AM, Alex Turbov  wrote:

> Hi,
>
> in my project I have `add_executable()`. after that, in a current binary
> dir I need to render a `*.cmake` script (via `configure_file()`) to be
> running from `add_test()` (as `cmake -P`) which should start just the
> compiled executable via `execute_process()` and capture its output (to be
> processed by followed commands)...
>
> the problem is: how to render an absolute path to the compiled executable
> inside the generated `*.cmake` script ??
> 0) access to LOCATION target property is prohibited from CMakeLists.txt,
> so I can't set it into a generated script
> 1) generator expressions don't work w/ `configure_file()`
>
> any other idea?
>
>
>
> --
>
> 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] No-op command?

2015-09-03 Thread Petr Kmoch
Hi Philip.

You don't need one. This is a perfectly valid piece of CMake code:

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
else()
  ... do something ...
endif()

Of course, the comment can be put in there, but you don't need any commands
between an if() and else() (or between any other pair of start-end style
commands, for that matter).

Petr

On Wed, Sep 2, 2015 at 9:12 PM, Philip Semanchuk  wrote:

> Hi there,
> Does CMake have a no-op command, like 'pass' in Python or ';' in C? I
> sometimes want to create a construct like this:
>
> IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
> # Under Windows we do nothing because blah blah blah
> ...no-op...
> ELSE()
> ...do something...
> ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
>
>
> Thanks
> Philip
> --
>
> 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

  1   2   3   4   >