Re: [CMake] Support for Boost 1.70.0

2019-04-12 Thread Michael Ellery
oh, sorry I misunderstood. How did you build/install boost on windows?

I’m not sure what “Variable View” is…is that a CMake gui thing?  Since it’s 
only complaining about a few libraries, is it possible that those three didn’t 
actually successfully build for one reason or another — maybe check the stage 
directory for the expected lib files (I believe you’d be looking for the “ 
-mt-x64.lib” files…)? If those files really are present, then I agree it’s a 
strange problem.


> On Apr 12, 2019, at 8:18 AM, Stephan Menzel  wrote:
> 
> Hello Michael,
> 
> thanks for your response.
> 
> On Fri, Apr 12, 2019 at 4:02 PM Michael Ellery  wrote:
> whenever I use bleeding-edge boost, I try to grab the latest FindBoost:   
> https://github.com/Kitware/CMake/commits/master/Modules/FindBoost.cmake
> 
> ..in particular, you probably want 
> https://github.com/Kitware/CMake/commit/266808c4130a0b40aed236381707462a9368a1eb#diff-555801259d7df67368f7deab1f9deacd
>  which doesn’t look like it’s been merged to release yet.
> 
>  
> I believe it has. I actually already tried those changes to no effect. It 
> seems not identical to the 3.14.2 version but the changes to the dependency 
> detection don't seem to be the issue. The problem is not so much that the 
> dependencies among the imported targets are wrong, the problem is that 3 of 
> those dependencies appear as NOT_FOUND, while they clearly are found.
> Still, FWIW I took the current commit and tried it, no change. Same error. 
> This is very mysterious.
> 
> Cheers,
> Stephan
> 
> 
> 
> -- 
> 
> 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] Support for Boost 1.70.0

2019-04-12 Thread Michael Ellery
whenever I use bleeding-edge boost, I try to grab the latest FindBoost:   
https://github.com/Kitware/CMake/commits/master/Modules/FindBoost.cmake

..in particular, you probably want 
https://github.com/Kitware/CMake/commit/266808c4130a0b40aed236381707462a9368a1eb#diff-555801259d7df67368f7deab1f9deacd
 which doesn’t look like it’s been merged to release yet.

-Mike

> On Apr 12, 2019, at 7:31 AM, Stephan Menzel  wrote:
> 
> Hello List,
> 
> Boost 1.70.0 was just released and I'm integrating it into our projects. I 
> notice FindBoost doesn't do the trick on Windows (MSVC141) anymore, on Linux 
> / G++ it works fine. Here's what I do:
> 
> set(Boost_USE_STATIC_LIBS   ON) 
> set(Boost_USE_MULTITHREADED ON)
> set(Boost_USE_STATIC_RUNTIME   OFF)
> set(Boost_USE_DEBUG_LIBS   OFF) 
> set(Boost_USE_DEBUG_RUNTIMEOFF) 
> 
> set(BOOST_INCLUDEDIR "${BOOST_ROOT}/include")
> set(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib")
> 
> find_package(Boost REQUIRED
>   COMPONENTS
>   system
>   filesystem 
>   random 
>   chrono
>   log
>   date_time 
>   regex
>   thread
>   fiber
>   exception
>   program_options 
>   unit_test_framework 
> )
> 
> It complains:
> Could not find the following static Boost libraries:
> 
> boost_system
> boost_log
> boost_unit_test_framework
> 
> Some (but not all) of the required Boost libraries were found. You may
> need to install these additional Boost libraries. Alternatively, set
> BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
> to the location of Boost.
> 
> Previous Boost versions worked. The libs are present as always and the same 
> code works fine with 1.69.  
> 
> set(Boost_ADDITIONAL_VERSIONS "1.70.0") doesn't change anything as 1.70.0 
> appears to be already in the known versions struct in FindBoost. 
> 
> I have tested with CMake 3.13.4 and 3.14.1. Both fail.
> 
> I have worked my way through the FindBoost module but can't figure out what 
> causes those 3 libs to appear missing. They do appear in the Variables View, 
> with their correct filenames. Everything seems to be fine but the error stops 
> execution. When I remove those 3 libs from the list, linking against imported 
> targets later breaks.
> 
> Does anybody have the same issue upgrading? Is there a workaround perhaps?
> 
> Cheers,
> Stephan
> -- 
> 
> 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] Problems with EnternalProjectAdd

2019-02-19 Thread Michael Ellery
Here’s a complete example that works on my system - maybe you can tweak it to 
your liking:


cmake_minimum_required (VERSION 3.9.0)
include (ExternalProject)
project (simple_ep)
set(BUILD_ENV "${CMAKE_BINARY_DIR}/build_env" CACHE STRING INTERNAL)
ExternalProject_Add(
  freetype
  PREFIX "${BUILD_ENV}/freetype"
  GIT_REPOSITORY "https://github.com/brooklynpacket/freetype2.git;
  GIT_TAG 64bit
  BUILD_IN_SOURCE true
  CONFIGURE_COMMAND
./autogen.sh
COMMAND
./configure
  BUILD_COMMAND
make
  TEST_COMMAND ""
  INSTALL_COMMAND ""
  LOG_DOWNLOAD ON
  LOG_INSTALL ON
  LOG_CONFIGURE ON
  LOG_BUILD ON
  LOG_TEST ON
  LOG_INSTALL ON
)

add_library (ft_lib STATIC IMPORTED GLOBAL)
ExternalProject_Get_Property (freetype SOURCE_DIR)
set_target_properties (ft_lib PROPERTIES
  IMPORTED_LOCATION
${SOURCE_DIR}/objs/.libs/libfreetype.a)
add_dependencies (ft_lib freetype)
add_executable (app main.cpp)
target_link_libraries(app ft_lib)


-Mike

> On Feb 18, 2019, at 10:25 PM, workbe...@gmx.at  wrote:
> 
> Can't i somehow output the pwd ??
> 
> best regards!
> 
> On 19.02.19 07:04, workbe...@gmx.at wrote:
>> Now i'm getting:
>> 
>>  Command failed: No such file or directory
>> 
>>'cd 
>> /home/stuv/data/projects/programming/bsUltimate/build/build_env/freetype/src/freetype
>>  && ./autogen.sh && ./configure && make'
>> 
>> but when i go to my bsUltimate path and type that command it works...
>> 
>> 
>> 
>> best regards!
>> 
>> On 19.02.19 06:57, Romain LEGUAY wrote:
>>> Hi,
>>> 
>>> I think you need to set the variable CONFIGURE_COMMAND to empty like this:
>>> 
>>>> ExternalProject_Add(
>>>> freetype
>>>> PREFIX "${BUILD_ENV}/freetype"
>>>> GIT_REPOSITORY "https://github.com/brooklynpacket/freetype2.git;
>>>> GIT_TAG 64bit
>>>  CONFIGURE_COMMAND ""
>>>> BUILD_COMMAND "cd ${CMAKE_BUILD_DIR}/freetype/src/freetype && 
>>>> ./autgen.sh && ./configure && make"
>>>> LOG_DOWNLOAD ON
>>>> LOG_INSTALL ON
>>>> LOG_CONFIGURE ON
>>>> LOG_BUILD ON
>>>> LOG_TEST ON
>>>> LOG_INSTALL ON
>>>> )
>>> 
>>> Envoyé de mon iPad
>>> 
>>> Le 19 févr. 2019 à 06:51, workbe...@gmx.at  a écrit :
>>> 
>>>> I played around a bit a now have the following:
>>>> 
>>>> set(BUILD_ENV "${CMAKE_BINARY_DIR}/build_env" CACHE STRING INTERNAL)
>>>> set(LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib" CACHE STRING INTERNAL)
>>>> 
>>>> ExternalProject_Add(
>>>> freetype
>>>> PREFIX "${BUILD_ENV}/freetype"
>>>> GIT_REPOSITORY "https://github.com/brooklynpacket/freetype2.git;
>>>> GIT_TAG 64bit
>>>> BUILD_COMMAND "cd ${CMAKE_BUILD_DIR}/freetype/src/freetype && 
>>>> ./autgen.sh && ./configure && make"
>>>> LOG_DOWNLOAD ON
>>>> LOG_INSTALL ON
>>>> LOG_CONFIGURE ON
>>>> LOG_BUILD ON
>>>> LOG_TEST ON
>>>> LOG_INSTALL ON
>>>> )
>>>> 
>>>> The logs are telling me: CMake Error: The source directory 
>>>> "/home/stuv/data/projects/programming/bsUltimate/build/build_env/freetype/src/freetype"
>>>>  does not appear to contain CMakeLists.txt.
>>>> 
>>>> Isn't the BUILD_COMMAND there if there is no CMakeLists.txt file available 
>>>> for building ? not many project provide cmake build files
>>>> 
>>>> 
>>>> best regards!
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On 19.02.19 06:43, Michael Ellery wrote:
>>>>> CMAKE_BUILD_DIR is not a standard variable (did you mean CMAKE_BINARY_DIR 
>>>>> ?) - and the error seems to indicate that the variable is indeed empty so 
>>>>> it tries to create the project directory at the root level.
>>>>> 
>>>>> -Mike
>>>>> 
>>>>>> On Feb 18, 2019, at 8:58 PM, workbe...@gmx.at  wrote:
>>>>>> 
>>>>>> Hi again,
>>>>>> 
>>>>>> i try to install my dependencies with ExternalProjec

Re: [CMake] Problems with EnternalProjectAdd

2019-02-18 Thread Michael Ellery
CMAKE_BUILD_DIR is not a standard variable (did you mean CMAKE_BINARY_DIR ?) - 
and the error seems to indicate that the variable is indeed empty so it tries 
to create the project directory at the root level.

-Mike

> On Feb 18, 2019, at 8:58 PM, workbe...@gmx.at  wrote:
> 
> Hi again,
> 
> i try to install my dependencies with ExternalProjectAdd but it gives me 
> troubles... what's wrong with
> 
> 
> ExternalProject_Add(
> freetype
> PREFIX "${CMAKE_BUILD_DIR}/freetype"
> GIT_REPOSITORY "https://github.com/brooklynpacket/freetype2.git;
> GIT_TAG 64bit
> BUILD_COMMAND "cd ${CMAKE_BUILD_DIR}/freetype/src/freetype && 
> ./autgen.sh && ./configure && make"
> LOG_DOWNLOAD ON
> LOG_INSTALL ON
> LOG_CONFIGURE ON
> LOG_BUILD ON
> LOG_TEST ON
> LOG_INSTALL ON
> )
> 
> 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] OBJECT libraries getting fully support?

2019-02-12 Thread Michael Ellery
https://cmake.org/cmake/help/latest/release/3.12.html says that 
target_link_libraries got OBJECT in 3.12 - is that what you had in mind?

-Mike

> On Feb 12, 2019, at 3:35 PM, Paul Smith  wrote:
> 
> Don't want to be a noodge but wondering if anyone has any thoughts
> about this question or ideas on how to solve my problem?
> 
> 
> On Sat, 2019-02-09 at 12:29 -0500, Paul Smith wrote:
>> Hi all;
>> 
>> I saw an email to the list from Chuck Atkins in the summer of 2017
>> suggesting that OBJECT libraries were being enhanced and could become
>> fully-functional libraries hopefully sometime that year.  I'm wondering
>> if that ever actally happened and if so what release of cmake it was
>> in, and if not is there still a plan for this sometime?
>> 
>> I'm trying to convert a large and complex cmake environment originally
>> started in 2007 or so, which uses all old-school cmake facilities, to
>> use modern cmake methods.
>> 
>> I have a situation where we have a library containing basic methods
>> which can be implemented multiple ways and different executables use
>> different implementations.  However these methods are used by all sorts
>> of static libraries as well.
>> 
>> Since we don't know until executable link time which library to use,
>> the static libraries cannot depend on the base library: it has to be
>> listed only in the executable's target_link_libraries.  But of course
>> because the static libraries use them as well we need the base library
>> to be listed last (or near last) in the link line else we get undefined
>> symbols.  Adding the base library to the executable TLL doesn't allow
>> us to do that.
>> 
>> So I was thinking of making this base library an OBJECT library so it
>> would always be fully linked but it seems that our version of cmake
>> doesn't allow an OBJECT library to be used as a normal library and I'd
>> be reduced to adding lots of generator expressions for it everywhere
>> which is a huge PITA.
>> 
>> Any ideas on how best to address this situation, if OBJECT libraries
>> are not supported yet?
> 
> -- 
> 
> 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] About FindBoost.cmake

2018-10-29 Thread Michael Ellery
I’m guessing you want to set Boost_USE_DEBUG_RUNTIME:

https://github.com/Kitware/CMake/blob/master/Modules/FindBoost.cmake#L1467


> On Oct 29, 2018, at 4:29 PM, Osman Zakir  wrote:
> 
> Hi again, everyone.
> 
> I noticed that FindBoost.cmake has "-d" set as the Boost debug ABI tag even 
> though the Boost libraries actually use "-gd".  I installed the latet release 
> of CMake just now, which has Boost 1.68.0 listed as a test version, and it 
> has this problem too.  For Boost.Filesystem, if it's an x64 multithreaded 
> debug lib (just take this as an example), the filename is 
> "libboost_filesystem-vc141-mt-gd-x64-1_68.lib".  For x86 it'd be 
> "libboost_filesystem-vc141-mt-gd-x32-1_68.lib".  
> 
> Just thought I'd send this email to report this.  
> -- 
> 
> 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] Problem with using CMake on Windows with Visual Studio 2017

2018-10-26 Thread Michael Ellery
look at the error message specifically:LDFLAGS=-static-libstdc++ 
-static-libgcc

Did you add something to your environment recently? Those look like gcc/clang 
flags - msvc is not going to like them.  Also, have you wiped your CMakeCache 
completely (clean configure)?  I’d have a look at your env variables to start 
with. Not generally needed, but you should also try building in a visual studio 
command prompt as it might properly set some of these ENV vars, just in case 
there is any confusion.

-Mike

> On Oct 26, 2018, at 9:48 AM, Osman Zakir  wrote:
> 
> Hi again, everyone.
> 
> I'm asking again.  If the reason I didn't get a reply last time was because I 
> didn't ask the right way for "hackers" to give me a satisfactory answer, 
> please let me know.  But if it was just because not enough people saw it, 
> then that's all the more reason for me to do this (right?).  
> 
> Anyway, I'm having problem using CMake to build a library on Windows.  The 
> library is Jinja2Cpp.  I asked on their GitHub page as well and they said it 
> might be a problem with VS or Windows itself since there's something in the 
> output that shouldn't be there in a normal build process.  I tried asking on 
> MSDN after that, but they just said to ask the library authors.  So I decided 
> to ask here instead, after that.  
> 
> This is the issue thread on the Jinja2Cpp GitHub page: 
> https://github.com/flexferrum/Jinja2Cpp/issues/75 .  
> 
> I'm also attaching the CMake logs to this message for you guys' reference.  
> 
> I tried building it more than once.  The command I used (on the command line) 
> was "cmake .. -DCMAKE_INSTALL_PREFIX=../install".  I was able to build it 
> successfully with VS2017 before.  This is only a recent problem.  
> 
> Can't Build Jinja2Cpp on Windows with Visual Studio 2017 Anymore · Issue #75 
> · flexferrum/Jinja2Cpp
> Just now, just to check, I tried to build the library on Windows again by 
> cloning fresh into Jinja2Cpp, updating the submodule, and then running cmake 
> -DCMAKE_INSTALL_PREFIX=../install and got this...
> github.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:
> 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] Problem with FindXercesC.cmake

2018-09-27 Thread Michael Ellery

> On Sep 27, 2018, at 2:55 PM, Mateusz Loskot  wrote:
> 
> 
> 
>> I use to rely on a custom FindXercesC.cmake file that was using XercesC_ROOT 
>> to figure all this out.
>> Is there any way to do the same here?
> 
> There seem to be no Xxx_ROOT_DIR handled by this module
> https://cmake.org/cmake/help/latest/module/FindXercesC.html
> 
> Best regards,
> -- 
> Mateusz Loskot, http://mateusz.loskot.net
> — 

although, if I understand correctly, it sounds like cmake 3.12 with policy 0074 
set might give you the xx_ROOT functionality without changing the find module:

https://cmake.org/cmake/help/latest/policy/CMP0074.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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linker and archiver options

2018-08-14 Thread Michael Ellery
This seems like something that would be best-suited for a toolchain file:

https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html

Have you given that a try? Also, I wonder if STATIC_LIBRARY_FLAGS is a custom 
setting, because I don’t think that one is a standard cmake variable.

-Mike

> On Aug 14, 2018, at 9:30 AM, Irina Chernushina via CMake  
> wrote:
> 
> Hi,
> 
> What is the correct way of setting archiver (and flags) and linker
> (and flags) outside the CMakeLists.txt?
> 
> 1) I am trying to use the following pattern:
> 
> cmake -DCMAKE_AR="" -DCMAKE_CXX_LINK_EXECUTABLE=" path> -o
>  " -DSTATIC_LIBRARY_FLAGS=""
> -DCMAKE_SHARED_LINKER_FLAGS=""
> -DCMAKE_EXE_LINKER_FLAGS=""
> 
> Is that in general correct options to pass that information?
> Judging by documentation, they are.
> 
> 2) However, I am getting the following warning:
> CMake Warning:
>  Manually-specified variables were not used by the project:
> 
>STATIC_LIBRARY_FLAGS
> (Also, in CMakeCache.txt this variable is UNINITIALIZED)
> 
> If I am trying to use CMAKE_STATIC_LINKER_FLAGS, I get in the cache:
> 
> //Path to a program.
> CMAKE_AR:FILEPATH=/usr/bin/ar
> ...
> //Flags used by the linker during the creation of static libraries.
> CMAKE_STATIC_LINKER_FLAGS:STRING=rcsD
> 
> But the link command looks like:
> 
> /usr/bin/ar qc libXXX.a rcsD file1.o .. filen.o
> /usr/bin/ranlib libz.a
> 
> and I get the error:
> /usr/bin/ar: rcsD: No such file or directory
> 
> Because the order of ar arguments is wrong, flags should come before "qc".
> 
> Thank you in advance
> Irina
> 
> 
> Irina Chernushina | Software Developer | ich...@google.com |
> 
> 
> Google Germany GmbH
> 
> Erika-Mann-Straße 33
> 
> 80636 München
> 
> 
> Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
> 
> Registergericht und -nummer: Hamburg, HRB 86891
> 
> Sitz der Gesellschaft: Hamburg
> 
> 
> Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise
> erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes
> weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich
> bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.
> 
> 
> 
> This e-mail is confidential. If you received this communication by
> mistake, please don't forward it to anyone else, please erase all
> copies and attachments, and please let me know that it has gone to the
> wrong person.
> --
> 
> 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



signature.asc
Description: Message signed with OpenPGP
-- 

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] Modular build system for repository with libraries shared between multiple targets.

2018-08-13 Thread Michael Ellery
it’s not clear to me why you are trying to do this multiple project thing…I 
mean why not just?:

project(myrepo)
add_subdirectory(util)
add_subdirectory(tool)
add_subdirectory(app)

and then if you only want to build util for instance:

cd build && cmake .. && cmake --build . --target=util

is there some other reason using the targets generated by the project doesn’t 
work for you?

-Mike

> On Aug 12, 2018, at 5:45 AM, Mateusz Zych  wrote:
> 
> Hi, I'm trying to understand what's the recommended way of
> implementing CMake build system in the following repository:
> 
> repo
> |
> |___ util
> ||___ include
> |||___ util
> || |___ util.h
> ||
> ||___ source
> |||___ util.cpp
> ||
> ||___ CMakeLists.txt
> |
> |___ tool
> ||___ include
> |||___ tool
> || |___ tool.h
> ||
> ||___ source
> |||___ tool.cpp
> ||
> ||___ CMakeLists.txt
> |
> |___ app
>  |___ app.cpp
>  |
>  |___ CMakeLists.txt
> 
> Essentially this repo contains static library util, shared library tool and 
> executable app.
> 
> Both executable app and shared library tool depend on static library util,
> but they don't depend on each other.
> This can be represented by dependency graph like so:
> 
> app   tool
>  ||
>  ||
>  VV
>   util
> 
> The reason why static library util is placed in the root of repo,
> is the fact that it's shared by both executable app and shared library tool.
> 
> Writing //repo/util/CMakeLists.txt is very easy:
> 
> cmake_minimum_required(VERSION 3.11)
> 
> project(util)
> 
> add_library(util STATIC)
> target_sources(util PRIVATE include/util/util.h
>   source/util.cpp)
> target_include_directories(util PUBLIC include)
> 
> However, implementing //repo/tool/CMakeLists.txt
> 
> cmake_minimum_required(VERSION 3.11)
> 
> # no project definition
> 
> add_library(tool SHARED)
> target_sources(tool PRIVATE include/tool/tool.h
>   source/tool.cpp)
> target_include_directories(tool PUBLIC include)
> target_link_libraries(tool PRIVATE util)
> 
> and //repo/app/CMakeLists.txt is more challenging.
> 
> cmake_minimum_required (VERSION 3.11)
> 
> # no project definition
> 
> add_executable(app)
> target_sources(app PRIVATE app.cpp)
> target_link_libraries(app PRIVATE util)
> 
> I understand CMake project as a set of targets, which are standalone (can be 
> built by themselves).
> Source: 
> https://stackoverflow.com/questions/26878379/in-cmake-what-is-a-project
> 
> This meas that I can define project util consisting of one target (static 
> library util),
> because target util doesn't have any dependencies, meaning it's standalone.
> Unfortunately defining project tool and project app is problematic,
> because executable app and shared library tool do depend on static library 
> util.
> 
> I found two solutions to this issue, but neither seems "correct" to me:
> 
> 1. Create //repo/CMakeLists.txt and define project repo which will add util, 
> tool and app as sub-directories.
> 
> cmake_minimum_required(VERSION 3.11)
> 
> project(repo)
> add_subdirectory(util)
> add_subdirectory(tool)
> add_subdirectory(app)
> 
> This is the cleanest solution, but it has a serious drawback of not defining 
> project app and project tool,
> which could be built independently from each other.
> 
> I thought that I will be able to mitigate this issue by
> defining multiple projects in //repo/CMakeLists.txt each with its own 
> separate set of targets.
> 
> cmake_minimum_required(VERSION 3.11)
> 
> project(tool)
> add_subdirectory(util)
> add_subdirectory(tool)
> 
> project(app)
> add_subdirectory(util)
> add_subdirectory(app)
> 
> project(repo)
> add_subdirectory(util)
> add_subdirectory(tool)
> add_subdirectory(app)
> 
> This is not possible, since one CMakeLists.txt can define only single project 
> and
> calling add_subdirectory() twice on the same directory is an error.
> I believe these constraints arise from the fact that
> CMake projects are not providing any scoping / grouping mechanism for targets.
> Source: https://cmake.org/pipermail/cmake/2009-June/030188.html
> 
> It is possible to create W/A mitigating this issue,
> by using if(), elseif() and else() commands in //repo/CMakeLists.txt,
> but this solution looks to me like an awful hack.
> 
> cmake_minimum_required(VERSION 3.11)
> 
> if(TOOL)
>   project(tool)
>   add_subdirectory(util)
>   add_subdirectory(tool)
> elseif(APP)
>   project(app)
>   add_subdirectory(util)
>   add_subdirectory(app)
> else()
>   project(repo)
>   add_subdirectory(util)
>   add_subdirectory(tool)
>   add_subdirectory(app)
> endif()
> 
> Making matters worse this approach requires global handling of 
> sub-directories in a project,
> meaning that knowledge of the whole dependency graph is required to add 
> sub-directories in correct order.
> This breaks down the most desirable properties of 

Re: [CMake] Can't find boost libs on VS2017 CMake 3.12

2018-08-02 Thread Michael Ellery
did you build boost yourself or download a pre-built package? What subdirectory 
are the import libraries (.lib) located in? Do you set any boost-finder 
variables before calling find_package(Boost)? I have at times in the past had 
to set BOOST_LIBRARYDIR when the package I was using had an odd lib file 
location, but I don’t think that’s typically needed.


> On Aug 2, 2018, at 6:24 AM, Søren  wrote:
> 
> Dear cmake community
> 
> I can't make CMake find the built boost libraries on Windows. At this line:
> 
> find_package(Boost REQUIRED COMPONENTS thread)
> 
> I get this error message:
> "Unable to find the requested Boost libraries.
> 
>   Boost version: 1.67.0
> 
>   Boost include path: C:/download/boost/boost_1_67_0
> 
>   Could not find the following static Boost libraries:
> 
>   boost_thread
> 
>   Some (but not all) of the required Boost libraries were found. You may
>   need to install these additional Boost libraries.  Alternatively, set
>   BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
>   to the location of Boost."
> 
> Other facts and observations:
> * Error both observed with stand alone Cmake 3.12, and the version cmake 3.11 
> that ships with VS2017.
> * VS2017 version 15.7.5 (currently the latest)
> * The same error with older Boost versions 1.65.x or 1.66
> * Building and linking the same program using VS2017 without cmake works fine.
> * It's not only threat that has the problem. Tested also date_time and chrono 
> with same errors.
> * Building a program with cmake that only requires boost headers-only-libs 
> works fine.
> * Building the same project on linux works fine.
> 
> Any ideas?
> Thanks in advance
> Soren
> 
> --
> 
> 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



signature.asc
Description: Message signed with OpenPGP
-- 

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] Beginning to compiling CMake file

2018-08-01 Thread Michael Ellery
So it sounds like you are on windows. First, be sure that the project that you 
are building claims support for windows. Windows is still the “odd man out” 
platform in many cases, so you don’t want to chase your tail with a project 
that never claimed windows support in the first place. That said, assuming 
windows is a supported build env, then it further sounds like you are using 
cmake-gui.

The most sensible generator is one of the visual studio ones - 64 or 32 bit 
depending on your needs. Once you have generated a project with cmake, you then 
open that generated project with VS.

Alternatively, however, I’d also suggest you consider just using the built-in 
CMake support in Visual Studio. If you download the latest version of VS (even 
the community version), then you can just open a CMakeLIsts.txt file directly 
and VS will run the generation step for you. It works pretty well in my limited 
experience. It can a little tricky to figure out how to set some non-default 
options in this workflow, but that’s more advanced usage anyhow.

-Mike


> On Jul 31, 2018, at 6:46 PM, CrestChristopher  
> wrote:
> 
> Hi, I'm using CMake for Windows as I was informed that I couldn't use `make` 
> as the CMakeLists.txt file was only for CMake.
> 
> Within CMake for Windows I select the location of the source code which is 
> the cloned repository which include the CMakeLists.txt file that I want to 
> compile, followed by I select a folder where to build the binaries; I'm then 
> prompt for a generator for the project. Up to this point am I doing this 
> correctly ?
> 
> Thank You
> 
> 
> 
> 
> On 7/31/2018 12:56 PM, Michael Ellery wrote:
>> typical usage would be something like (assuming you are at repo root) :
>> 
>> mkdir mybuild && cd mybuild
>> cmake -DCMAKE_BUILD_TYPE=Release ..
>> cmake —build .
>> 
>> you can also opt to configure cmake (the equivalent of the first cmake 
>> command above) using a GUI like ccmake or cmake-gui if you prefer. The cmake 
>> build type can be changed depending on your needs. If the project depends on 
>> other libraries/tools, you might need to install those before building.
>> 
>> HTH,
>> Mike
>> 
>>> On Jul 30, 2018, at 9:17 PM, CrestChristopher  
>>> wrote:
>>> 
>>> Hi, I'm a beginner to CMake and for weeks I've been trying to compile a 
>>> CMake file which I found on a github repository.  All I can say is I have a 
>>> CMakeLists.txt file but I don't know how to compile and I hope someone can 
>>> help ?
>>> 
>>> Christopher
>>> 
>>> --
>>> 
>>> 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
> 



signature.asc
Description: Message signed with OpenPGP
-- 

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] Beginning to compiling CMake file

2018-07-31 Thread Michael Ellery
typical usage would be something like (assuming you are at repo root) :

mkdir mybuild && cd mybuild
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake —build .

you can also opt to configure cmake (the equivalent of the first cmake command 
above) using a GUI like ccmake or cmake-gui if you prefer. The cmake build type 
can be changed depending on your needs. If the project depends on other 
libraries/tools, you might need to install those before building.

HTH,
Mike

> On Jul 30, 2018, at 9:17 PM, CrestChristopher  
> wrote:
> 
> Hi, I'm a beginner to CMake and for weeks I've been trying to compile a CMake 
> file which I found on a github repository.  All I can say is I have a 
> CMakeLists.txt file but I don't know how to compile and I hope someone can 
> help ?
> 
> Christopher
> 
> --
> 
> 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



signature.asc
Description: Message signed with OpenPGP
-- 

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] advice for resolving errors with CMake 3.8

2018-05-02 Thread Michael Ellery

> On May 2, 2018, at 3:55 PM, Alan W. Irwin <ir...@beluga.phys.uvic.ca> wrote:
> 
> On 2018-05-02 09:45-0700 Michael Ellery wrote:
> 
>> I generally develop on a latest cmake (provided by homebrew) and that works 
>> well for me. Unfortunately, I also need to support Visual Studio builds and 
>> it looks like the cmake that is bundled with VS is 3.8. I’m apparently using 
>> bleeding-edge features related to IMPORTED libraries, judging by these 
>> errors:
>> 
>> ||   Cannot specify include directories for imported target “some_lib”.
>> 
>> ||   add_library cannot create ALIAS target “NIH::some_lib" because target
>> ||   “some_lib" is IMPORTED.
>> 
>> ||   Cannot specify compile options for imported target “some_lib".
>> ||
>> 
>> What is the recommended way to deal with include dirs and compile settings 
>> for IMPORTED targets with pre-3.11?
> 
> Hi Michael:
> 
> Just in case nobody comes up with a simple solution for your question
> about taking the backward step (in my opinion) of making your build
> system compatible with CMake-3.8, have you tried to download and
> install CMake version 3.11 from KitWare for Windows to see if that
> works well for your VS platform?  (My guess is you would merely need
> to change the PATH so that CMake version 3.11 rather than CMake
> version 3.8 was used, but I don't have any VS experience so it might
> be more complicated than that.) Anyhow, I thought this idea was worth
> a shot since it allows you to stick with CMake-3.11 compatibility for
> your build system.
> 
> Alan

HI Alan, 

Thanks for your suggestion. I wish it were that easy, but the bundled VS CMake 
is pretty tightly coupled and you can’t easily replace it. I believe they also 
rely on one or two features they might have added or enabled in their build of 
cmake - so they are currently maintaining a divergent fork that hopefully will 
eventually get mainlined (?).

In the meantime, it looks like I just need to switch to set_target_properties 
for 3.8 instead of trying to use target_include_directories on an IMPORTED 
target. This seems to be working so far.

Thanks,
Mike

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

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

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

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


[CMake] advice for resolving errors with CMake 3.8

2018-05-02 Thread Michael Ellery
I generally develop on a latest cmake (provided by homebrew) and that works 
well for me. Unfortunately, I also need to support Visual Studio builds and it 
looks like the cmake that is bundled with VS is 3.8. I’m apparently using 
bleeding-edge features related to IMPORTED libraries, judging by these errors:

||   Cannot specify include directories for imported target “some_lib”.

||   add_library cannot create ALIAS target “NIH::some_lib" because target
||   “some_lib" is IMPORTED.

||   Cannot specify compile options for imported target “some_lib".
|| 

What is the recommended way to deal with include dirs and compile settings for 
IMPORTED targets with pre-3.11? 

Thanks,
Mike


-- 

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] Parallel build setup question

2018-02-16 Thread Michael Ellery
I don’t know anything about QTCreator, but the question really boils down to 
how to get your IDE to pass extra args to the build tool - it’s not really a 
cmake issue except to the extent that CMake can be used to invoke the build 
step (after it has been used to generate the build).  It sounds like QT uses 
“cmake --build” to do the build phase (which makes sense), so you just need to 
add your “-j N” argument to the build step invocation. If you believe this:  
https://doc.qt.io/qtcreator/creator-build-settings.html, then it sounds like 
maybe “Tool Arguments” is what you want (see “CMake Build Steps”) ?  BTW, the 
way I do this myself (since I don’t use an IDE) is something like “cmake 
--build . -- -j 8”  where the double dash stops shell argument processing and 
effectively passes everything else on to the build tool that cmake ultimately 
invokes (e.g. make or ninja or msbuild, etc.)

HTH,
Mike

> On Feb 16, 2018, at 8:31 AM, Cornelis Bockemühl  
> wrote:
> 
> Hello,
> 
> Somehow I seem to miss some crucial point regarding setup for parallel build 
> with CMake, so I would be happy if somebody can push me the last few 
> millimeters to hit my target!
> 
> My configuration is on OpenSuse Linux (Leap - 64-bit), working with QtCreator 
> and CMake, using the "make" configuration.
> 
> I learned from "the internet" that actually I would have to pass a -jN option 
> to make or gmake (with N being the max number of processors I want to use). 
> Or even more elegant: go for a -lN option to somehow balance the load. Sounds 
> good!
> 
> But what I do not see is how to pass these nice options to make through CMake 
> and QtCreator! One attempt was to specify CMAKE_CXX_FLAGS=-j4 or the like 
> because some comment "in the internet" seemed to suggest this. However, like 
> I already feared: this passes the option to the compiler call - and that is 
> the wrong address for it, so I get an error message.
> 
> Basically I think that it is 99% a CMake question and maximum 1% a QtCreator 
> problem, so I am asking this question here.
> 
> And now I am stuck - if not some friendly and knowing person can help me out 
> of this!
> 
> Thanks for any helpful hint!
> Cornelis
> -- 
> 
> 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


[CMake] CMake + mdvc + --build + jenkins

2018-02-01 Thread Michael Ellery
I know this is a long-shot, but I’m wondering if anyone has encountered this 
scenario:

CMake (3.10) being used to generate a project for Visual Studio 15 (the current 
latest)

the build is running on a windows machine under a jenkins slave process

The generation step runs fine

I then run cmake in build mode, and the build basically completes (based on the 
fact that I see the executable produced).  BUT the child MSBuild processes 
never exit and thus the build is stuck (cmake is still waiting…)

I’ve tried running the jenkins slave process in a console window (foreground) 
just to eliminate any service/service account issues, but it makes no 
difference.

More important, if I instead invoke MSBuild directly rather than use “cmake 
—build . ……”, the process behaves fine and runs to completion.

This experiment makes me think something is odd about how cmake spawns the 
MSBuild process - perhaps some child event or signal is not being handled?

In any event, I’m not blocked by this since I can simply run MSBUILD directly 
in the build script, but I wondered if this is a known issue or if others have 
encountered it.

Also, I’ll note that I’m passing /nr:false to msbuild in both cases because 
that is common recommendation for running msbuild under CI.

-Mike



signature.asc
Description: Message signed with OpenPGP
-- 

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] Generate headers and inherit include_directories

2017-10-03 Thread Michael Ellery
maybe a CMake snippet of what you are trying would help clarify, but are you 
using an interface library for your header-only? I would assume yes - and then 
have to tried add_dependency() for that library to trigger the file generation? 
The dependency will only be resolved when the library is used by an exe or 
installed (I think), but that should be sufficient?

-Mike

> On Oct 3, 2017, at 6:54 AM, Nagy-Egri Máté Ferenc via CMake  
> wrote:
> 
> Hi!
> 
> I am a seasoned Cmake user but cannot solve a fairly simple problem, so I 
> might be mistaking the forest for the trees.
> 
> I have a project in which there is a custom_command/custom_target pair that 
> creates a header file as part of a (currently) header-only target. I want to 
> create an imported target (or really, any kind of target), which is 
> responsible for triggering header generation at build time AND relaying the 
> include directory so consumers need not worry about the location where the 
> generated header files go. My problem is:
> 
>   • I cannot invoke target_include_directories on a custom_target
>   • Imported targets cannot have source files (for proper depending on 
> the result header file)
>   • Imported targets cannot link to a custom_target
>   • Interface and Unkown libraries cannot be non-imported
>   • All other library types result in objects/libraries (which I don’t 
> need)
> 
> How can I create the dependency graph where my custom_command is invoked if 
> the inputs to it change (or if its output doesn’t exist yet) and depending 
> targets are rebuilt accordingly AND I also inherit build properties (include 
> directories)?
> 
> Cheers,
> Máté
> --
> 
> 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



signature.asc
Description: Message signed with OpenPGP
-- 

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 the default build type?

2017-07-31 Thread Michael Ellery


> On Jul 31, 2017, at 8:48 PM, Florian Lindner  wrote:
> 
> Hello
> 
> ccmake shows CMAKE_BUILD_TYPE as unset. From the compile commands it looks 
> like also nothing like Debug nor Release.
> 
> Why is there no well-defined default set? How can I set a default?
> 
> Thanks,
> Florian
> -- 
> 
> 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


my recollection is that an unspecified build type results in a build that has 
no optimizations and no debug symbols generated. I’m not sure what the 
motivation for those default flags is. If you want to default to DEBUG, 
something like this should work:

if (NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Debug)
endif()


-MIke

-- 

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-10 Thread Michael Ellery

> 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…)

-Mike

-- 

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 have build steps operate on files in a copied directory?

2017-07-10 Thread Michael Ellery

> On Jul 10, 2017, at 11:19 AM, Christopher E Robison  
> wrote:
> 
> The INSTALL(SCRIPT ...) syntax might be just the answer I need, thanks!.  
> 
> As I mentioned, the index creating script in the custom step needs to operate 
> on the copied directory tree in its final location, so if it's not all there 
> yet it will fail.  So, if CMake has some distinction between "build" and 
> "install"  (I'm familiar with Makefiles, where the syntax enforces no such 
> separation -- just targets, dependencies, and commands), then this would mean 
> the step has to be executed at the end of the "install" phase.
> 
> Can I specify somehow that this install command must be executed after the 
> INSTALL(DIRECTORY ...) command has completed?
> 
> 
> Thanks,
> CR
> 
> 

I *believe* the install directives are executed in the order they are 
encountered in the processing of CMakeLists files, so putting the custom step 
as the last item in your top level CMake file might do the trick. 


-- 

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 have build steps operate on files in a copied directory?

2017-07-10 Thread Michael Ellery

> On Jul 10, 2017, at 10:46 AM, Christopher E Robison  
> wrote:
> 
> I've recently begun using CMake on an existing project I've taken over, and I 
> feel like I'm mostly getting used to it, though there is still a vast amount 
> to learn.  I've got nearly the entire project building successfully, with the 
> exception of a directory of external scripts that need to be configured at 
> the end of the install process to create some index files.
> 
> So, in a nutshell, there's a script that takes care of this post-install 
> configuration, that needs to be executed once the target tree of directories 
> and script files are in place, copied from the source tree. And I'm finding 
> that when the script is called during the build, the INSTALL(DIRECTORY ...) 
> command from the CMakeLists.txt directory hasn't been run yet, so the tree of 
> script files hasn't been put in place yet and the script (and the build) 
> fails.
> 
> FWIW, if I leave out the add_custom_command and add_custom_target that 
> execute the script, the directory tree does copy correctly.
> 
> I have not found any guidance on how to specify that the directory tree gets 
> copied first. How is this normally done?
> 
> 
> Thanks,
> CR
> 
> 
> 

I think you might be getting confused by two distinct phases: BUILD and INSTALL.

BUILD is what happens when building your sources and all the results of this 
step are in your build directory (or source directory if you do in-source 
building). Both add_custom_command and add_custom_target are evaluated (and 
potentially executed) at BUILD time.  The BUILD phase is what is processed when 
you just do “make” in Makefile terms.

INSTALL is what happens when you request your project to be installed. The 
various install() directives in your CMake files will be processed during 
INSTALL. In Makefile terms, this what happens when you do “make install” (BUILD 
is also done in that case since INSTALL always depends on BUILD)

So the first question is: does this custom step need to be done at BUILD time 
or INSTALL time? Running custom code is easier at BUILD time since you have the 
add_custom_command and the like. If you need to run custom code at INSTALL 
time, maybe consider this:

https://stackoverflow.com/questions/41254902/cmake-run-script-for-install-target

…although I have not done something like this myself. I suspect it is difficult 
to get just right, depending on the various platforms you support.

Does that make sense?

-Mike 



-- 

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] Tell cmake use /usr/include/db.h, not /usr/local/include/db.h

2017-07-09 Thread Michael Ellery

> On Jul 9, 2017, at 4:16 AM, Larry Hynes  wrote:
> 
> Hi
> 
> I'm building nvi2[0], on (Mac OS X Yosemite (10.10.5)), which uses
> cmake.
> 
> nvi2 depends on a reasonably sane BSD environment, which would
> include Berkeley DB V1 which is found at /usr/include/db.h.
> 
> I also have installed BDB V4, which lives at /usr/local/include/db.h,
> for use by other programs.
> 
> The only way I can get nvi2 to build, is to uninstall BDB V4, in
> which case cmake picks up V1 and all is well. Otherwise cmake
> resolutely picks up V4 and the build fails.
> 
> I'm trying to figure out if it is possible to tell cmake to use the
> V1 that is at /usr/include/db.h.
> 
> I've tried various invocations of find_path and find_library in
> CMakeLists.txt, with and without appeals to default paths and such
> like, to no avail. I've tried any variation of -DCMAKE_XXXFLAGS I
> can think of, in CMakeLists.txt and on the command line, to no
> avail. (When using find_XXX, cmake tells me they're found, but still
> uses DB4. In the case of passing flags, cmake tells me that it
> is ignoring them.)
> 
> Now, at day's end, this is not A Big Deal; I uninstall BDB4, build
> nvi2, reinstall BDB4. But one would imagine that there is some
> (simple) way to instruct cmake to use X over Y when building Z?
> 
> [0] https://github.com/lichray/nvi2
> 

system include order path is implementation defined, but it sounds to me like 
your compiler (clang) is behaving in a fairly normal way - that is, it checks 
/usr/local/include before /usr/include, which allows you to have newer versions 
of libs in local. This has nothing to do with CMake - this is standard compiler 
behavior.  So, now it sounds like you want to change that default behavior for 
this target. If you can figure out the right set of flags to pass to clang to 
get it to find the right header, then it’s possible to convince CMake to pass 
those flags using something like target_compile_options(). 

The CMake find_path and find_library functions don’t do anything magical…they 
just simplify the process of searching various locations on your filesystem for 
the specified files, and conveniently find_library knows about library file 
naming convention. When those functions are used, they just end-up setting some 
variables to tell you what it found and where, but they don’t do anything 
special with compiler flags. It’s up to you to take the results (variables) of 
those functions and pass them along to your compiler/toolchain as you see fit.

So that’s the challenge here - figure out how to convince your compiler to 
ignore /usr/local/include, at least of this one dependency. If you have other 
things in /usr/local/include that you depend on, then this might be very 
tricky.  It looks like the -include option to clang might allow you to specify 
a full path to a file to include before preprocessing, but that might also 
require that you remove all #include  from your sources - I don’t know if 
that’s feasible.

If it were up to me, I’d probably choose to not install the newer lib to 
/usr/local because fighting the compiler regarding system include paths is not 
fun. If/when I needed the newer version, I’d put it in some non-system path 
(like /opt) and then tell the compiler to treat that alternate path with top 
precedence if/when I need to use the newer version. That’s just my 2 cents.

-Mike

-- 

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] Platform dSPACE

2017-06-23 Thread Michael Ellery

> On Jun 23, 2017, at 1:11 PM, Robin Verschueren  
> wrote:
> 
> Thank you, that makes sense.
> 
> If I do that, how can I set specific settings for this Platform only? It 
> seems that e.g.
> 
> set(CMAKE_INCLUDE_FLAG_C "-J")
> 
> in the Toolchain file is overwritten by CMake after processing the Toolchain 
> file
> (more specifically, in CMakeGenericSystem.cmake).
> 
> Or should I set this variable somewhere else?
> 
> Best,
> Robin

I think you use the toolchain file to declare the basics (what compiler to use) 
and then you can add specific flags and other settings in your other CMAKE 
files *after* the project() declaration (which usually clobbers a bunch of 
settings…). If you want to have your compiler flags/settings in a reusable 
file, you can just use the basic include() support to import a separate file, 
but it still needs to come after project() most likely.



-- 

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] Platform dSPACE

2017-06-23 Thread Michael Ellery

> On Jun 23, 2017, at 1:01 PM, Michael Ellery <mellery...@gmail.com> wrote:
> 
> 
>> On Jun 23, 2017, at 12:47 PM, Robin Verschueren 
>> <robin.verschue...@gmail.com> wrote:
>> 
>> Dear CMake,
>> 
>> We are trying to build our application for the dSPACE embedded system
>> (www.dspace.com), more specifically their MicroAutobox-II. This makes
>> use of a specific compiler called mccppc (Microtec C/C++ PowerPC compiler).
>> 
>> I was following the instructions on this wiki page, when I got the following 
>> warning, 
>> when trying to use a custom 'Toolchain' file:
>> 
>> System is unknown to cmake, create:
>> Platform/dSPACE to use this system, please send your config file to 
>> cm...@www.cmake.org so it can be added to cmake
>> 
>> We would be glad to send it to you when it is finished, but in the meantime,
>> we cannot debug our toolchain file because of above warning.
>> 
>> Is there a way of including it without having to include it in the official 
>> CMake
>> distribution? I tried setting CMAKE_MODULE_PATH but that did not help..
>> 
>> 
>> Best regards,
>> Robin
>> -- 
> 
> what happens if you set
> -DCMAKE_TOOLCHAIN_FILE=path/to/your/toolchain.cmake  when running cmake…does 
> that give any different result? 
> 

sorry - I misunderstood the nature of your error. I think this might be 
relevant:

"If your target is an embedded system without OS set CMAKE_SYSTEM_NAME to 
"Generic”.   “


-- 

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] Platform dSPACE

2017-06-23 Thread Michael Ellery

> On Jun 23, 2017, at 12:47 PM, Robin Verschueren  
> wrote:
> 
> Dear CMake,
> 
> We are trying to build our application for the dSPACE embedded system
> (www.dspace.com), more specifically their MicroAutobox-II. This makes
> use of a specific compiler called mccppc (Microtec C/C++ PowerPC compiler).
> 
> I was following the instructions on this wiki page, when I got the following 
> warning, 
> when trying to use a custom 'Toolchain' file:
> 
> System is unknown to cmake, create:
> Platform/dSPACE to use this system, please send your config file to 
> cm...@www.cmake.org so it can be added to cmake
> 
> We would be glad to send it to you when it is finished, but in the meantime,
> we cannot debug our toolchain file because of above warning.
> 
> Is there a way of including it without having to include it in the official 
> CMake
> distribution? I tried setting CMAKE_MODULE_PATH but that did not help..
> 
> 
> Best regards,
> Robin
> -- 

what happens if you set-DCMAKE_TOOLCHAIN_FILE=path/to/your/toolchain.cmake  
when running cmake…does that give any different result? 

-- 

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] Forcing CMake to find static library

2017-06-09 Thread Michael Ellery
if you know exactly where the library is (via the ENV), then I guess you want 
to specify the NO_DEFAULT_PATH option to find_library. Alternatively, see if 
you can use the standard find module included with cmake:

https://github.com/Kitware/CMake/blob/master/Modules/FindLAPACK.cmake

..and in that case you could set LAPACK_ROOT using your ENV value.

HTH,
Mike

> On Jun 9, 2017, at 10:39 AM, Matthias Redies  wrote:
> 
> Hello,
> 
> I am trying to force CMAKE to include a specific static lapack library,
> set through the environment variable $LAPACK_LIB:
> 
> > ls $LAPACK_LIB
> libblas_extra.a  libcblas.a  liblapack.a  liblapacke.a libtmglib.a
> 
> > echo $LAPACK_LIB
> /bgsys/local/lapack/3.7.0/lib
> 
> 
> This is how I am trying to do it in CMake:
> 
> cmake_minimum_required(VERSION 2.5)
> project(TEST)
> 
> file(GLOB_RECURSE sources  src/*.f90)
> 
> add_executable(cmake.x ${sources})
> find_library(MY_LAPACK liblapack.a HINTS $ENV{LAPACK_LIB}
> NO_CMAKE_LIBRARY_PATH)
> 
> MESSAGE(STATUS "Lapack location: ${MY_LAPACK}")
> 
> target_link_libraries(cmake.x ${MY_LAPACK} ${MY_ESSL})
> 
> enable_language(Fortran)
> 
> 
> If I run CMake this results in:
> 
> > cmake .
> -- Lapack location: /usr/lib64/liblapack.so
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /work/jias12/jias1217/lapack_test
> 
> 
> How can I force CMake to find the correct library file and not some
> random one laying around on the system?
> 
> 
> Kind regards
> 
> 
> Matthias
> 
> 
> 
> 
> 
> Forschungszentrum Juelich GmbH
> 52425 Juelich
> Sitz der Gesellschaft: Juelich
> Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
> Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
> Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
> Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
> Prof. Dr. Sebastian M. Schmidt
> 
> 
> 
> -- 
> 
> 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


[CMake] rpath linker args

2017-05-19 Thread Michael Ellery
I’m wondering if anyone knows the details of rpath linker args. In particular, 
I have two paths in my CMAKE_BUILD_RPATH. On macOS, I end-up with something 
like this:

….  -Wl,rpath=/path/number/one -Wl,rpath=/path/number/two ….

and on linux with the same CMakeLists.txt file, I get:

…. -Wl,rpath=/path/number/one:/path/number/two … 

I can’t tell from man pages if that second form is even allowed or what the 
linker will do with it, but my observation is that the RPATH is indeed set for 
the macOS binary and it is NOT set for the linux binary. 

Thoughts/advice ? Anything else I can try to force the first format to be used 
on linux?

Thanks,
Mike Ellery

-- 

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] Generating include files

2017-05-19 Thread Michael Ellery

> On May 19, 2017, at 3:48 PM, Urs Thuermann  wrote:
> 
> Craig Scott  writes:
> 
>> A bit of a long-shot, have you tried generating the file with the extension
>> .h instead of .c? That might allow it to be picked up by the dependency
>> scanner (I don't know if it treats file extensions differently). Also, the
>> add_custom_command(OUTPUT...) call needs to be in the same
>> CMakeLists.txt
> 
> No, I have tried that before in several variations, and nothing
> worked.
> 


Here:

https://github.com/mellery451/gen_header

works for with me with makefile generator.

-Mike
-- 

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] Generating include files

2017-05-19 Thread Michael Ellery

> On May 19, 2017, at 2:00 PM, Urs Thuermann <u...@isnogud.escape.de> wrote:
> 
> Michael Ellery <mellery...@gmail.com> writes:
> 
>> if your source can be generated by simple substitution of variable
>> values (like a template file), then configure_file() will do the
>> trick. If the process to create the file is more complex, then
>> add_custom_command() with an appropriate OUTPUT specification is
>> probably what you want, something like:
> 
> Yes, the awk example was a simplification.  The table to be generated
> is much larger using a somewhat more complex specification.  I don't
> want to calculate at run-time in foo.c, but at compile-time so that it
> can go into a static const int array.
> 
>> add_custom_command(OUTPUT tab.c  COMMAND "awk -f mktab > tab.c")
> 
> I have tried dozens of combinations with add_custom_command(),
> include_directories(), and ${CMAKE_BINARY_DIR}.  Also the way you
> show.  But the only way I found to have tab.c actually generated was
> to put tab.c into the add_executable() specification, but then it
> generates a tab.o which is linked into the executable.  But I want to
> have the tab[] static, i.e. included into a C file, not linked in.
> 
>> You will need to make sure that some other target explicitly depends
>> on tab.c (or whatever you name the output) to cause this custom rule
>> to be executed.
> 
> Is there a way to specify that foo.o depends on tab.c?  For some
> reason cmake's scan does not seem to find this.
> 

well, if you rename tab.c to tab.h, I’m pretty sure CMAKE will honor it as a 
dependency but won’t compile it..so that might be the easiest.

Alternatively, use set_source_file_properties to set 
https://cmake.org/cmake/help/v3.8/prop_sf/OBJECT_DEPENDS.html#prop_sf:OBJECT_DEPENDS

-Mike
-- 

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] Generating include files

2017-05-19 Thread Michael Ellery

> On May 19, 2017, at 1:00 PM, Urs Thuermann  wrote:
> 
> How can I write a CMakeFile that will include a generated source file
> into another C source?  I have read the FAQ, searched the mailing list
> archives and have tried for two hours without success.
> 
> With standard make this would be quite simple:
> 
>   $ cat Makefile
>   foo: foo.o
>   
>   foo.o: tab.c
>   
>   tab.c:
>   awk -f mktab > $@
>   $ cat foo.c
>   #include "tab.c"
>   
>   int main() { return tab[0]; }
>   $ cat mktab
>   #!/usr/bin/awk
>   
>   BEGIN{ print "static int tab[] = { 0, 1, 2 };"; exit }
>   $ make
>   awk -f mktab > tab.c
>   cc-c -o foo.o foo.c
>   cc   foo.o   -o foo
>   $ 
> 
> How would I do this with cmake?
> 
> urs
> — 
> 

if your source can be generated by simple substitution of variable values (like 
a template file), then configure_file() will do the trick. If the process to 
create the file is more complex, then add_custom_command() with an appropriate 
OUTPUT specification is probably what you want, something like:

add_custom_command(OUTPUT tab.c  COMMAND "awk -f mktab > tab.c")

If you don’t like where the files are generated, you can tweak WORKING_DIR 
and/or use full-paths to the file(s).

You will need to make sure that some other target explicitly depends on tab.c 
(or whatever you name the output) to cause this custom rule to be executed.

-Mike


-- 

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] Release flags on one target in debug build type

2017-05-05 Thread Michael Ellery

> On May 5, 2017, at 11:45 AM, Konstantin Tokarev  wrote:
> 
> Hello,
> 
> Is there any clear way to build specific target in "Debug" mode with flags 
> that it would have in "Release"?
> 
> In particular, build this specific target without effect of 
> CMAKE_CXX_FLAGS_DEBUG and CMAKE_C_FLAGS_DEBUG, while preserving flags added 
> by target_compile_options
> 
> -- 
> Regards,
> Konstantin
> -- 
> 
> 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


Does RelWithDebInfo do what you want? I have in the past taken one of the 
“alternative targets” (RelWithDebInfo or MinSIzeRel) and adjusted the flags for 
that target until it suited my specific needs, but I don’t necessarily claim 
that is the right way to go in all cases. Also be aware that the default 
optimization level can differ slightly with each of these build types. In the 
end, it’s probably best to survey the current settings for each build type and 
see if one is close to what you want.

-Mike

-- 

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] linking boost to cmake under OSX 10.12.1 , boost 1.63 , cmake 2017.11

2017-05-03 Thread Michael Ellery

> On May 3, 2017, at 8:20 PM, Sean Wayland  wrote:
> 
> Hi all,
> 
> I am very new to cmake and boost. Sorry if my question is basic thanks for 
> your help in advance. 
> 
> I am having trouble linking a project to boost. I am using OSX 10.12.1 
> I am using clion 2017.1.1 
> 
> I installed boost on my machine using /bootstrap.sh --prefix=/usr/local/boost 
> --with-libraries=filesystem,system
> 
> I also tried a brew install boost also . 
> 
> Boost can indeed be found here usr/local/boost/ on my machine. 
> 
> I haven't had much luck getting boost to link properly. 
> 
> I believe the project uses the filesystem and tuple modules. 
> 
> I am getting this error 
> 
> CMake Error at CMakeLists.txt:557 (ADD_EXECUTABLE):
>   Cannot find source file:
> 
> anyExecutable.cpp
> 


This error means that it can’t find the named source file. The path is relative 
to the CMakeLists.txt file in which you define the target. Does that source 
file exist in that location? 


> From what I have read I think that if you are using OSX that you have to use 
> the FIND_PACKAGE command to link things properly. I suspect that the code 
> below doesn't work because I need to properly place the exact filesystem 
> location of the executable file created in the add_executable command. 
> On a positive note I did get this message 
> -- Boost version: 1.63.0
> -- Found the following Boost libraries:
> --   program_options
> -- Configuring done
> 

This indicates that it found some version of boost, but it seems only the 
program_options library. I would add message(“$Boost_LIBRARIES”) after your 
find_package() statement to print out the location of the found libraries to 
see if that matches your expectation. I generally prefer to do a full staged 
build of boost from source..that typically looks like “./bootstrap.sh && ./b2 
stage” — and I then I point to that staged build using a BOOST_ROOT environment 
variable (the CMake boost finder will honor BOOST_ROOT, I believe). You can 
also just do a ./b2 install to put everything in /usr/local/. 

> I have tried various versions of these 2 cmakelists scripts below (A) and (B) 
>  
> 
> Can anyone point me in the direction of a solution here? 
> 
> 
> A) 
> 
> FIND_PACKAGE( Boost 1.63.0 COMPONENTS program_options REQUIRED )
> INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
> 
> ADD_EXECUTABLE( anyExecutable anyExecutable.cpp )
> 
> TARGET_LINK_LIBRARIES( anyExecutable ${Boost_LIBRARIES} )
> B) 
> INCLUDE_DIRECTORIES(usr/local/boost/include/)
> 
> ADD_EXECUTABLE(  anyExecutable myMain.cpp )
> 
> TARGET_LINK_LIBRARIES( anyExecutable usr/local/boost/lib/ )
> 
> 

version (A) seems closer to what you want to me - but I suspect the error you 
posted was from option (B). Perhaps try running A again and share the error 
message(s) you get with that.

-Mike


-- 

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] Overriding the include path, library path of OpenSSL, Zlib and libcurl

2017-04-21 Thread Michael Ellery
after find_package is invoked, several variables will be set. You use these to 
augment your compiler and linker information, e.g.:

target_include_directories(mytarget $ZLIB_INCLUDE_DIRS)
target_link_libraries(mytarget $ZLIB_LIBRARIES)

…and so on for other modules you find (OpenSSL, for example).  You can also 
choose to add the include paths “globally” using include_directories(), but 
it’s usually considered best practice to modify individual target properties 
where possible.

-Mike
..
> On Apr 21, 2017, at 10:58 AM, Alex Chen <alex_c...@filemaker.com> wrote:
> 
> Although cmake uses the path I supplied for OpenSSL and Zlib, I do not see 
> the –I flag being used in compiling the code. (I set VERBOSE=1 to make to see 
> what it does.)
> When I run ‘ldd’ against the resulting .so files, reference to libssl.so or 
> libcrypto.so is empty, i.e ‘libssl.so => not found’, but libz.so still links 
> to /lib64/libz.so. (It seems to ignore the fact it does find a new path of 
> zlib.)
>  
> How to I set the linker flag, i.e. –L and –Wl,-rpath=$myLibPath ?
>  
> Alex Chen
>  
> From: CMake <cmake-boun...@cmake.org> on behalf of Alex Chen 
> <alex_c...@filemaker.com>
> Date: Friday, April 21, 2017 at 10:28 AM
> To: CMake <cmake@cmake.org>
> Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, 
> Zlib and libcurl
>  
> Thanks for the help.  I will try that. 
>  
> Alex Chen
>  
> From: Michael Ellery <mellery...@gmail.com>
> Date: Thursday, April 20, 2017 at 8:13 PM
> To: Alex Chen <alex_c...@filemaker.com>
> Cc: CMake <cmake@cmake.org>
> Subject: Re: [CMake] Overriding the include path, library path of OpenSSL, 
> Zlib and libcurl
>  
> It doesn’t look like that find module directly supports HINTS or PATHS, so 
> you can try setting CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH  
> (https://cmake.org/cmake/help/v3.7/variable/CMAKE_LIBRARY_PATH.html) before 
> calling the curl finder. I think you can add to those variables whatever 
> paths are appropriate to search for CURL on your systems.
>  
> -Mike
>  
>> On Apr 20, 2017, at 6:06 PM, Alex Chen <alex_c...@filemaker.com> wrote:
>> The source code I want to compile on Linux uses ‘FindOpenSSL’, ‘FindZLIB’, 
>> and ‘FindCURL’ to resolve the paths of these libraries.
>> However, I have newer version of these libraries in different locations.  
>> How to I override these to use my paths?
>> I am able to use OPENSSL_ROOT_DIR, from FindOpenSSL module, and ZLIB_ROOT, 
>> from FindZLIB module, to override the paths.  
>> But I cannot find anything in FindCURL module to override the path of 
>> libcurl.
>>   
>>   
>> Alex Chen
>> -- 
>> 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_FAQKitware 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

Re: [CMake] Overriding the include path, library path of OpenSSL, Zlib and libcurl

2017-04-20 Thread Michael Ellery
It doesn’t look like that find module directly supports HINTS or PATHS, so you 
can try setting CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH  
(https://cmake.org/cmake/help/v3.7/variable/CMAKE_LIBRARY_PATH.html) before 
calling the curl finder. I think you can add to those variables whatever paths 
are appropriate to search for CURL on your systems.

-Mike

> On Apr 20, 2017, at 6:06 PM, Alex Chen  wrote:
> 
> The source code I want to compile on Linux uses ‘FindOpenSSL’, ‘FindZLIB’, 
> and ‘FindCURL’ to resolve the paths of these libraries.
> However, I have newer version of these libraries in different locations.  How 
> to I override these to use my paths?
> I am able to use OPENSSL_ROOT_DIR, from FindOpenSSL module, and ZLIB_ROOT, 
> from FindZLIB module, to override the paths.  
> But I cannot find anything in FindCURL module to override the path of libcurl.
>  
>  
> Alex Chen
> -- 
> 
> 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] Handling generated headers

2017-03-27 Thread Michael Ellery

> On Mar 27, 2017, at 2:57 PM, Bruce Stephens <bruce.r.steph...@gmail.com> 
> wrote:
> 
> Yes, that's the idea: I have custom commands (created with
> add_custom_command) listing the headers in OUTPUT.
> 
> And there are source files which #include such headers.
> 
> I'd like it so that compiling such a source file would cause the
> header to be generated.
> 
> Concretely, with a CMakeLists.txt like the attached, with the obvious
> main.c (also attached), I'd like "ninja exe" to work.
> 
> I find that it does not.
> 
> After "ninja build-incl" (or "ninja incl.h") then "ninja exe" will
> work. And then after removing incl.h,
> "ninja exe" will recreate incl.h and then rebuild exe. (Presumably
> ninja is caching some dependency information, likely
> in its .ninja_deps file.) But correct recompilation (while obviously
> desirable) doesn't seem sufficient; I want the first
> build to work too.
> 
> (I'm also not sure why the add_custom_target is required, but it does
> seem to be. Presumably without it CMake
> can't see why the custom command might be used.)
> 
> In most cases I have a natural place where I need the things to be
> built, so the custom target can have ALL DEPENDS
> (rather than.the DEPENDS in the example). However, in some cases in
> parallel builds I still end up with (sometimes)
> source files not compiling because the needed headers haven't been generated.
> 
> As I say, so far this is OK: I can just generated dependencies
> explicitly in a pre-CMake step. But handling cases where
> main.c includes some source header which includes this generated
> incl.h seems not easily doable.
> 
> If I'm not missing something silly and all this is expected behaviour
> (as it appears to be) it's not a disaster. We can add
> a few explicit dependencies and get things to work. But maybe I'm
> missing something and this should work more
> smoothly.
> 
> 
> On Mon, Mar 27, 2017 at 4:08 PM, Michael Ellery <mellery...@gmail.com> wrote:
> 

Doing this worked for me:


add_executable(exe main.c ${CMAKE_CURRENT_BINARY_DIR}/incl.h)

target_include_directories(exe PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/incl.h
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/incl.h)


..in other words, I used the binary dir as the output location of the generated 
file and then I explicitly added the header file to the sources list. Yeah, it 
would be nice if header reps auto detection worked in this case, but it seems 
like it does not, so you form the dependency relationship explicitly I guess.

-Mike


-- 

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] Handling generated headers

2017-03-27 Thread Michael Ellery

> On Mar 27, 2017, at 6:31 AM, Bruce Stephens  
> wrote:
> 
> I have a build with two or three tools that generate headers and
> source files. Getting the source files compiled is easy enough: when
> they're mentioned as source files (in add_library or add_executable)
> the custom rule gets triggered.
> 
> But that doesn't seem to be true for header files included by
> non-generated source files, presumably because CMake's not looking at
> those files, but rather Ninja is (presumably other generators will
> behave similarly). If the (generated) header changes then anything
> using
> the source file gets rebuilt (as expected), but the first build seems
> not to necessarily succeed (depending on accidents of when the
> generated files are produced).
> 
> Concretely, suppose I have an XML file compat.xml with a custom rule
> to generate messages/Compat.h, and some source files which include
> that header (which does not exist to begin with), I'd like a compile
> of any of those source files to depend on messages/Compat.h such that
> it'll be generated if necessary.
> 
> That doesn't seem to happen automatically using the Ninja generator.
> Is that expected, or have I messed something up?
> 
> For the moment I'm assuming it's as expected and have a workaround: a
> simple Python script that scans source files and creates a deps.cmake
> with calls
> to add_file_dependencies. (Fortunately all the generated headers have
> simple patterns so accurately determining them is straightforward.)
> 
> Unfortunately there are also (non-generated) header files which
> include these headers and that seems harder to handle.
> Calling add_file_dependencies on header files doesn't seem to work.
> 
> It's not a showstopper: I can just explicitly add some dependencies.
> And later, we'll probably split out some of these things so they'll
> be separate builds. It seems a bit annoying, though. Am I missing some
> better way to handle this?
> -- 


it’s not clear from your message — are you using add_custom_command() to create 
the rule that generates the header from the XML? If you get all of the 
parameters right to that command (like OUTPUT, DEPENDS, BYPRODUCTS..), then I 
would expect this to work and the header should get generated before any other 
source that needs it. In some cases you might need to explicitly specify that a 
target depends on that header, but if at least ONE thing depends on the header, 
the the add_custom_command rule should get executed.  You might also try 
running CMAKE with —trace and generating a verbose makefile if you are still 
not seeing your custom command running when it should.

-Mike Ellery
-- 

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] Include file in the Makefile

2017-03-23 Thread Michael Ellery

> On Mar 22, 2017, at 2:07 PM, Hom Nath Gharti  wrote:
> 
> Dear all,
> 
> I use PETSc in my package and I need to use the following line in my
> GNU Makefile:
> 
> include ${PETSC_DIR}/lib/petsc/conf/variables
> 
> What is the equivalent command for CMakeLists.txt for this?
> 
> Thanks for your help.
> 
> Thanks,
> HNG
> -- 

The typical way to use an installed library is via find_package, which requires 
either a pkgspec or a find module. It looks like someone has already written a 
find module:

https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake

so, you can do something like:

* fork/or submodule this repo above 
* append to CMAKE_MODULE_PATH in your CMakeLists.txt file to add the path to 
this module above.
* call find_package(PETSc)
* use the variables that are documented in the finder to set your 
include_directories and target_link_libraries.

If you are certain the env variable PETSC_DIR is always going to be set (as 
above), then you can simply build paths based on that variable and pass them to 
include_directories and target_link_libraries, but the finders also do a better 
job of dealing with various build environments, etc.

HTH,
Mike Ellery
-- 

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] Error from GenerateExportHeader.cmake (configure_file)

2017-03-03 Thread Michael Ellery

> On Mar 3, 2017, at 9:23 AM, Miroslav Drahos  wrote:
> 
> Hi,
> I am getting errors emanating from GenerateExportHeader.cmake and hope 
> someone has any pointers on this. The error:
> 
> CMake Error at /usr/share/cmake-3.5/Modules/GenerateExportHeader.cmake:362 
> (configure_file):
>   configure_file Problem configuring file
> Call Stack (most recent call first):
>   /usr/share/cmake-3.5/Modules/GenerateExportHeader.cmake:378 
> (_do_generate_export_header)
>   
> /slave/workspace/build-1.7.0/aurissw/Main/CMake/AsrCreateLibraryMacro.cmake:161
>  (generate_export_header)
> 
> The relevant portion of the custom AsrCreateLibraryMacro.cmake is pretty 
> standard, according to cmake docs:
> 
>   unset(exportMacro)
>   string(TOUPPER ${TARGET} exportMacro)
>   set(exportMacro "${exportMacro}_DLLSPEC")
>   set(exportHeader ${TARGET}_export.h)
>   generate_export_header(${TARGET}
> BASE_NAME ${TARGET}
> EXPORT_MACRO_NAME ${exportMacro}
> EXPORT_FILE_NAME ${exportHeader}
> )
> 
> where TARGET is always set to a valid string (library name).
> 
> The error is not consistent among machines -- on some machines this error is 
> never seen, on others, it consistently fails. All of these machines run a 
> pretty standard Linux distribution (most of them Ubuntu 16.04), and use the 
> same cmake 3.5.1.
> 
> Here is the system version that we are using:
> Linux version 4.4.0-36-generic (buildd@lcy01-01) (gcc version 5.4.0 20160609 
> (Ubuntu 5.4.0-6ubuntu1~16.04.2) ) #55-Ubuntu SMP Thu Aug 11 18:01:55 UTC 2016
> We have a machine with the exact same system version that builds fine and a 
> machine that cmake consistently fails. 
> 
> Has anyone experienced a similar error? Any clues on what may be the problem?
> Thank you tons,
> Miro

This might just be a filesystem error when writing the configured header file. 
I would try message() printing the value of ${exportHeader} and 
${CMAKE_CURRENT_BINARY_DIR} before calling GEH to make sure the filepath looks 
valid and writeable.

-Mike
-- 

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] Forcing linking compatability to old libc / libstdc++ (Linux)

2017-01-26 Thread Michael Ellery

> On Jan 26, 2017, at 1:45 PM, Gonzalo Garramuño <ggarr...@gmail.com> wrote:
> 
> 
> 
> El 26/01/2017 a las 18:35, Michael Ellery escribió:
>> In what way is the stdlib incompatible? Does it have bugs, or is this more a 
>> matter of cpp standard support?
> I should have been more clear.  Sorry.   The incompatabilities happen at 
> linker time, with complaints such as:
> 
> exrstdattr: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found 
> (required by exrstdattr )
> exrstdattr: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found 
> (required by /usr/local/mrViewer/lib/libIlmImf-2_2.so.22 )
> 
> If I copy the latest libstdc++.so.6 I have on Ubuntu, I get:
> 
> exrstdattr: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by 
> /usr/local/mrViewer/lib/libstdc++.so.6 )
> 
> -- 
> Gonzalo Garramuño
> 

oh, yeah - I wasn’t paying close attention to the fact that you are 
distributing *binaries* — to a different distro no less. This is why projects 
often either tell users to build from source or they create packages (rpms, 
dpkgs, etc.) on the specific distros and versions. 

That said, if you want to distribute binaries to a different distro, I guess 
you can try static linking OR what you suggested, shipping the stdlib — see:

http://stackoverflow.com/questions/13636513/linking-libstdc-statically-any-gotchas#14082540

I personally would not want to ship a stdlib myself, but using CMake’s RPATH 
support, you can probably make it work.

-Mike

-- 

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] Forcing linking compatability to old libc / libstdc++ (Linux)

2017-01-26 Thread Michael Ellery

> On Jan 26, 2017, at 1:23 PM, Gonzalo Garramuño  wrote:
> 
> I currently own an Ubuntu Xenial 14.04.1 LTS box in which I do all my work.   
>  I distribute a binary image viewer.   However, recently one of my users 
> tried to run the viewer on a CentOS 7 distro and found out that that distro 
> libc and libstdc++ are older and incompatible.
> 
> I would like to compile my program targeting the older libc and libstdc++.  
> Those files come with symbol version and visibility. Is there an easy way to 
> do that other than copying the old libraries?
> 
> Any help or hint is appreciated.
> 

In what way is the stdlib incompatible? Does it have bugs, or is this more a 
matter of cpp standard support? If you want to enforce/require a certain 
standard of cpp, for instance, have a look at:

https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD_REQUIRED.html

If you want to enforce certain language features, you can consider specifying 
compile-features:

https://cmake.org/cmake/help/v3.1/manual/cmake-compile-features.7.html
https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#prop_gbl:CMAKE_CXX_KNOWN_FEATURES

Now, that might still not solve the immediate problem of an old toolchain on 
Centos7, but at least CMake will make clear to the user what’s missing.  For 
Centos/Redhat specifically, I’ve had good luck with devtoolset for 
installing/using an updated toolchain:

https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3

HTH,
Mike Ellery



-- 

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 and generating sources

2017-01-26 Thread Michael Ellery

> On Jan 26, 2017, at 1:23 AM, David Jobet  wrote:
> 
> Hello,
> 
> suppose I want to use protobuf and integrate it in my project with 
> externalproject_add. (actually, I just have precompiled binaries and libs + 
> header files, I don't have the full sources)
> Once the project has been 'built' (actually, installed by a custom rpm-like 
> tool to a shared path), I can use the protoc compiler to generate protobuf 
> c++ files (.pb.h and .pb.cpp files) from a .proto description file.
> I can add_dependencies so that the external project is built before projects 
> depending on libprotobuf.a.
> 
> However, I don't know how to do the same thing with .pb.h and .pb.cpp files 
> which use a .proto file and the protoc compiler.
> 
> make is fine with it, but ninja complains with an error like this :
> ninja: error: '/path_to_external_projects/protobuf/2.6.0.4/bin/protoc', 
> needed by 'some_project/SomeFile.pb.h', missing and no known rule to make it
> 
> how can I tell ninja that protoc is going to be provided by externalproject ?
> If I use byproducts, ninja is happy, but "ninja clean" deletes 
> /path_to_external_projects/protobuf/2.6.0.4/bin/protoc.
> I don't want that to happen since 
> /path_to_external_projects/protobuf/2.6.0.4/bin/protoc is shared with other 
> users.
> 

I’ve never used protobufs as an external project (I’ve always just done a 
one-time setup/install)…but is there a reason you can’t just use the standard 
finder to locate it?  
https://github.com/Kitware/CMake/blob/master/Modules/FindProtobuf.cmake

-Mike

-- 

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] Generate a file with a custom command as part of build

2017-01-25 Thread Michael Ellery

> On Jan 24, 2017, at 11:22 PM, doug livesey  wrote:
> 
> Is there any way that I can make the files webpack compiles into dependencies 
> for the Webpack task? So that any changes to those are picked up for 
> recompilation?
> No worries if not, I just thought it would be nice.
> 

just add any files on which the command depends after the DEPENDS argument. I 
only added the one source file in that example, but you can add as many as are 
appropriate.

-Mike


-- 

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] Generate a file with a custom command as part of build

2017-01-24 Thread Michael Ellery
The syntax of your add_custom_target is not quite right…I would try something 
more like:

add_custom_target( Webpack ALL 
$WEBPACK 
DEPENDS  webpack.config.js
BYPRODUCTS  public/bundle.js
)

…that’s untested, of course. I you do that, then I think you don’t need the 
add_custom_command at all….but you will still want to make some of your other 
targets depend on this target if they need bundle.js before they run.

> On Jan 24, 2017, at 11:34 AM, doug livesey <biot...@gmail.com> wrote:
> 
> Hi -- sorry about the really late reply, I've been away. Up to Hadrian's 
> Wall, and then for a Dark Skies observatory evening.
> It was ace. :)
> I've added the following to my CMakeLists.txt file:
> 
> > set(WEBPACK ${CMAKE_SOURCE_DIR}/node_modules/.bin/webpack)
> > configure_file(webpack.config.js webpack.config.js)
> > add_custom_target(public/bundle.js)
> > add_custom_command(OUTPUT public/bundle.js COMMAND ${WEBPACK})
> 
> However, when I try to run `cmake ..` (I'm using a build subdirectory), I get 
> the following error:
> 
> > CMake Error at CMakeLists.txt:30 (add_custom_target):
> >   add_custom_target called with invalid target name "public/bundle.js".
> >   Target names may not contain a slash.  Use ADD_CUSTOM_COMMAND to generate
> >   files.
> 
> I'm guessing that this means that I should be running some of those commands 
> in a CMakeLists.txt file in a subdirectory (maybe public/) and calling 
> `add_subdirectory(public)` from my top-level file?
> I've tried this a couple of ways, but so far haven't got it working.
> Am I on the right sort of approach, or have I wandered far from the beaten 
> track?
> Thanks again for your help,
>Doug.
> 
> On 22 January 2017 at 00:16, Michael Ellery <mellery...@gmail.com> wrote:
> add_custom_command is the probably the right thing…but it needs to be 
> triggered by a dependency relationship. You will specify public/bundle.js as 
> the OUTPUT parameter of the add_custom_command and then some other target or 
> install command needs to have that file listed in its sources, and then CMAKE 
> will understand that it needs to run the custom command to generate that 
> OUTPUT file before it runs the dependent target. I think add_custom_command 
> can also be explicitly linked to a specific target (there are two forms of 
> the command) - and in that case I think it always runs (?) when that target 
> rebuilds…I’m not completely sure about that, so you might need to test.
> 
> Alternatively, if you want to run the generation at the time of makefile 
> generation (when CMAKE is run…), then have a look at execute_process. The 
> downside of that is that it will generally always run when CMAKE is run, but 
> never during the make process so it doesn’t really handle updates to the 
> source (input) files very well. I’m not sure which technique applies best to 
> your situation here.
> 
> HTH,
> Mike
> 
> > On Jan 21, 2017, at 4:01 PM, doug livesey <biot...@gmail.com> wrote:
> >
> > Hi, I want to call the following command as part of a build:
> >
> > $ ./node_modules/.bin/webpack
> >
> > This should generate a file public/bundle.js
> >
> > I'm really struggling with this. I guess there's something fundamental that 
> > I'm not understanding. `add_custom_command` doesn't seem to be doing 
> > anything.
> > I would anticipate that it would put the command I want to call in the 
> > makefile, but it hasn't.
> > If anyone could advise me on what I'm not getting here, that would be 
> > brilliant.
> > Cheers,
> >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] Generate a file with a custom command as part of build

2017-01-21 Thread Michael Ellery
add_custom_command is the probably the right thing…but it needs to be triggered 
by a dependency relationship. You will specify public/bundle.js as the OUTPUT 
parameter of the add_custom_command and then some other target or install 
command needs to have that file listed in its sources, and then CMAKE will 
understand that it needs to run the custom command to generate that OUTPUT file 
before it runs the dependent target. I think add_custom_command can also be 
explicitly linked to a specific target (there are two forms of the command) - 
and in that case I think it always runs (?) when that target rebuilds…I’m not 
completely sure about that, so you might need to test.  

Alternatively, if you want to run the generation at the time of makefile 
generation (when CMAKE is run…), then have a look at execute_process. The 
downside of that is that it will generally always run when CMAKE is run, but 
never during the make process so it doesn’t really handle updates to the source 
(input) files very well. I’m not sure which technique applies best to your 
situation here.

HTH,
Mike

> On Jan 21, 2017, at 4:01 PM, doug livesey  wrote:
> 
> Hi, I want to call the following command as part of a build:
> 
> $ ./node_modules/.bin/webpack
> 
> This should generate a file public/bundle.js
> 
> I'm really struggling with this. I guess there's something fundamental that 
> I'm not understanding. `add_custom_command` doesn't seem to be doing anything.
> I would anticipate that it would put the command I want to call in the 
> makefile, but it hasn't.
> If anyone could advise me on what I'm not getting here, that would be 
> brilliant.
> Cheers,
>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] installing source (or object) files

2017-01-19 Thread Michael Ellery
I think my initial reaction to installing a source (cxx) file is that you 
should install a static library instead (.a) - which is basically what you are 
suggesting. Just define a new static library target that includes the cxx file 
and install it…should work fine. If there are headers needed to use that static 
lib, you install those as well. There is a third type of library target called 
OBJECT, but those are usually just for use in the context of a build and not 
meant to be installed (if i recall correctly…).

HTH,
Mike Ellery

> On Jan 18, 2017, at 11:49 PM, Kris Thielemans  
> wrote:
> 
> Hi
>  
> I haven’t had any replies to my message below, hopefully because it was sent 
> at the wrong time of year… So I’m reposting, but with some  clarifications.
>  
> I wrote the message about include_flags only. I’ve currently solved this by 
> adding a variable 
>  
>Set(STIR_INCLUDE_DIRS blabla)
>  
> in my STIRConfig.cmake.in (which is at 
> https://github.com/UCL/UCL-STIR/blob/master/src/cmake/STIRConfig.cmake.in)
>  
> and tell the user of the library that they have to do
>  
> include_directories(${STIR_INCLUDE_DIRS})
>  
> This works but only for include directories, not for other compiler flags. 
> I’ve currently solved that by putting all (most?) of these in a 
> STIRConfig.h.in.
>  
> I don’t particularly like the include_directories solution however. I believe 
> CMake’s eport facility is trying to get away from this. Indeed, for the 
> library, its include path (and other compilation flags) get automatically 
> exported, so the user doesn’t have to do anything else than 
> target_link_libraries to inherit all necessary flags.
>  
> Also, my current solution relies on exporting the .cxx. It seems safer to 
> export the object file as that is guaranteed to have been compiled with the 
> correct flags, but I don’t know how to do that.
>  
> I hope my message below makes more sense now.
>  
> Thanks
>  
> Kris
> From: Kris Thielemans
> Sent: 27 December 2016 16:12
> To: cmake@cmake.org
> Subject: installing source (or object) files
>  
> Hi all
>  
> I have a non-standard set-up where I have a library that needs to be linked 
> together with some extra source files that contain “registries”). So in my 
> CMakeLists.txt I use
>  
> Add_executable(wonderful_program wonderful_program.cxx registry.cxx)
> target_link_libraries(wonderful_program mylib)
>  
> registry.cxx needs to be compiled with some of my include files.
>  
> For that, I added
>  
> include_directories(“${PROJECT_SOURCE_DIR}/src/include”)
>  
> I guess I could just as well have added
>  
> SET_PROPERTY(SOURCE registry.cxx PROPERTY COMPILE_FLAG 
> "-I${STIR_INCLUDE_DIR}")
>  
>  
> This works fine, but now I want to export my library (relocatable). I have 
> created a config file etc, added mylib as an install target, installed the 
> include files etc. All of that works great for the library. However, I have 
> no idea how to install registry.cxx. I could just 
>  
> INSTALL(FILES registry.cxx …)
>  
> However, that doesn’t copy the properties of the source files anywhere. In 
> particular, it means that a “client” doesn’t know what compilation flags to 
> use.
>  
> Any ideas?
>  
> Best wishes for 2017!
>  
> Kris
>  
> PS: The reason that I need registry.cxx is that it contains some variables 
> that have a funky constructor that initialises some registries somewhere.
> PS: Full source code is at https://github.com/UCL/STIR
> -- 
> 
> 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] Install destination problem

2016-12-28 Thread Michael Ellery
This might be helpful:

http://stackoverflow.com/questions/39481958/setting-cmake-install-prefix-from-cmakelists-txt-file/39485990#39485990

Also, FWIW, the generated makefile (if you are using the makefile generator) 
supports DESTDIR which will get prepended to the CMAKE_INSTALL_PREFIX path 
(which sounds like it is not useful in your case).

-Mike

> On Dec 28, 2016, at 8:52 AM, Chris Johnson  wrote:
> 
> I've found experimentally that if the install directory exists, it works 
> correctly.  If it does not exist, the prefix somehow gets changed to 
> /usr/local.  I've not found where that's getting set yet.
> 
> Thanks for the recommendation on CACHE.
> 
> On Wed, Dec 28, 2016 at 9:46 AM, Kris Thielemans 
>  wrote:
> Hi
> 
>  
> 
> My guess is that you have a local variable CMAKE_INSTALL_PREFIX being 
> shadowed by the global variable. Best to add the CACHE keyword etc in your 
> set statement, then there’ll be only 1 variable.
> 
>  
> 
> Kris
> 
>  
> 
> From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Chris Johnson
> Sent: 27 December 2016 23:27
> To: cmake@cmake.org
> Subject: [CMake] Install destination problem
> 
>  
> 
> In all of my CMakeLists.txt files, I include a settings file, like so:
> 
>  
> 
> include(global_settings.cmake)
> 
>  
> 
> Inside global_settings.cmake, I have a line like this:
> 
>  
> 
> set( CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install )
> 
>  
> 
> When I run "make install" on my development system, the files are correctly 
> installed where I expect to find them, in a subdirectory of my build 
> directory named "install".
> 
>  
> 
> But when I tried to do the same on our production server just now, it tried 
> to install the binaries into /usr/local/bin.
> 
>  
> 
> It's as if $CMAKE_INSTALL_PREFIX did not get set.
> 
>  
> 
> What am I doing wrong?
> 
> 
> -- 
> 
> 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] List all "include_directories" for a given project or target

2016-11-21 Thread Michael Ellery

> On Nov 21, 2016, at 5:04 AM, Michael Jackson  
> wrote:
> 
> Is there a command or variable or a code snippet from someone that 
> essentially has a list of all the "include_directories" that have been 
> used/created in a given project? Or can I get a list of all the 
> targets(created and imported) and then get the list of "include_directories" 
> from those targets?
> 
> I am messing about with the "VSCode.app" on OS X and their code completion 
> extension. For this to work one needs to get a list of all the include 
> directories possible so that clang knows where to look for the headers.
> 
> Wasn't there a cmake command that would dump all the compile commands to a 
> file or something?
> 
> Thanks
> 
> 


The clang compilation database might give you what you need - it’s what several 
autocompletion tools already use. To generate this, just pass  
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON when running cmake. You would have to 
extract the -I options from the command entries, I guess.

-Mike




-- 

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] CXX_CLANG_TIDY doesn't handle multiple arguments correctly

2016-11-16 Thread Michael Ellery

> On Nov 16, 2016, at 2:32 PM, Nikita  wrote:
> 
> Indeed, specifying '-line-filter=[]' doesn't cause any troubles.
> Should I file a bug about this?
> 
> Regards,
> Nikita
> 

FWIW, I brought up the same issue a few weeks ago:

http://stackoverflow.com/questions/40433573/how-can-i-specify-additional-arguments-for-use-with-cmake-cxx-clang-tidy-variabl

http://public.kitware.com/pipermail/cmake/2016-November/064501.html

I think this is a bug, but wasn’t sure how to classify it.

-Mike


-- 

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] additional arguments with CMAKE_CXX_CLANG_TIDY variable

2016-11-08 Thread Michael Ellery

> On Nov 8, 2016, at 10:06 AM, Bill Hoffman <bill.hoff...@kitware.com> wrote:
> 
> On 11/8/2016 11:20 AM, Michael Ellery wrote:
>> /usr/local/Cellar/cmake/3.6.2/bin/cmake -E __run_iwyu
>> --tidy="/usr/local/opt/llvm38/bin/clang-tidy-3.8;-checks=*"
>> --source=/Users/ellery/work/.
> That should still work.  It is passing that to -E __run_iwyu which should 
> expand the arguments.
> 
> https://gitlab.kitware.com/cmake/cmake/blob/master/Source/cmcmd.cxx#L353
> cmSystemTools::ExpandListArgument will separate out the arguments.  My guess 
> is the * might be causing the trouble somehow.
> 
> -Bill
> 
> 

Thanks - a quick test using `checks=google-runtime-memset`  (for example) does 
NOT fail, so your speculation about * causing issues seems pretty likely. I’m 
not sure if this is a bug or if there is some other workaround for special arg 
characters...

-- 

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] additional arguments with CMAKE_CXX_CLANG_TIDY variable

2016-11-08 Thread Michael Ellery
I asked this question on SO and am repeating here with the hope someone knows 
the answer:

http://stackoverflow.com/questions/40433573/how-can-i-specify-additional-arguments-for-use-with-cmake-cxx-clang-tidy-variabl

——
I'm trying to use make use of clang-tidy integration with cmake and I'd like to 
pass the -check argument. I've tried adding 
-DCMAKE_CXX_CLANG_TIDY="/usr/local/opt/llvm38/bin/clang-tidy-3.8;-checks=*" 
when invoking cmake, but my makefile commands end-up looking like:

/usr/local/Cellar/cmake/3.6.2/bin/cmake -E __run_iwyu 
--tidy="/usr/local/opt/llvm38/bin/clang-tidy-3.8;-checks=*" 
--source=/Users/ellery/work/.

in other words, it seems like the ; separated args are not being parsed apart. 
I've also tried setting the target property CXX_CLANG_TIDY directly on my 
target with the same value and I get the same behavior. If I remove ‘;checks=*’ 
from the string, everything works fine, but I get default clang-tidy behavior.

Has anyone succesfully invoked clang-tidy with additional args through cmake?
——

Thanks,
Mike Ellery



-- 

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] Custom clang compiler unrecognised on OS-X

2016-10-19 Thread Michael Ellery
This is a complete stab in the dark, but I wonder if your clang (Xcode tools…) 
needs reactivation. I know some people have reported that they’ve needed to 
re-accept the license and/or reinstall the Xcode tools following the upgrade. 
Again, this is just a wild guess.


> On Oct 19, 2016, at 2:44 AM, James Turner  wrote:
> 
> Some recent configuration change (either upgrading to Sierra or CMake 3.5.0) 
> has prompted the following warning when running Cmake on a particular project:
> 
> 
> CMake Error in /CMakeLists.txt:
>  No known features for CXX compiler
> 
>  "Clang"
> 
>  version 3.5.0.
> ==
> 
> This project uses a mixture of Fortran and C++ - the Fortran compiler is 
> GFortran, and the C++ compiler is a custom clang with OpenMP support, 
> supplied by Homebrew (as is CMake). I assume the error is somehow related to 
> using a non-Apple Clang, but prior to upgrading either Xcode/the OS to 
> Sierra/to Cmake 3.5, the message did not appear. (When I say ‘custom’, it’s 
> simply that Apple choose to disable OpenMP in their official builds shipped 
> with Xcode, the compiler I’m using is the stock mainline clang with OpenMP 
> support re-enabled)
> 
> The message is repeated for each CMakeList.txt in the project, and of course 
> I’ve googled it, but can only find references to unsupported compilers, when 
> this system was introduced. Is there an issue with my CmakeLists.txt files, 
> or some missing configuration file in Cmake, or something else again 
> happening?
> 
> Running ‘-v’ on the OpenMP clang from Homebrew reports:
> 
> =
> clang-omp -v
> clang version 3.5.0 
> Target: x86_64-apple-darwin16.0.0
> Thread model: posix
> ===
> 
> I run Cmake with a command like: (in my build dir)
> 
> CC=/usr/local/bin/clang-omp CXX=/usr/local/bin/clang-omp++  cmake 
> ../my-project/
> 
> Any hints appreciated!
> 
> Kind regards,
> James
> 
> --
> James Turner - Senior Software Developer
> KDAB - The Qt, C++ and OpenGL Experts
> 
> 
> 
> 
> -- 
> 
> 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] after running cmake, getting an error cannot find -levent

2016-09-15 Thread Michael Ellery
that seems to refer to libevent and the linker is not finding it - so you 
probably need to build/install that lib for your toolchain. It doesn’t look 
like there is a standard finder module for libevent currently, but if there 
were then find_package(LibEvent) would have likely alerted you when running 
cmake.

-Mike

> On Sep 15, 2016, at 10:03 AM, Gunter, Walter E  
> wrote:
> 
> Subject: after running cmake, getting an error cannot find -levent
>  
> I am cross-compiling for an arm, and can run cmake successfully, but when I 
> run make, I am getting the following:
>  
> /opt/toolchains/arm-2008q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld:
>  cannot find -levent
>  
> I tried adding –levent to COMPILE_FLAGS, but that didn’t work either.
>  
> set(COMPILE_FLAGS "-lrt –levent -Wall -lpthread")
>  
> Thoughts?
>  
>  
> Walter E. Gunter, Jr.
>  
> -- 
> 
> 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 source tree pollution ?

2016-09-09 Thread Michael Ellery
This kinda’ sounds like you are doing an in-source build. Are you certain that 
your currrent/working directory is different from your source tree root when 
you run cmake? The typical way of doing this is just to make a subdirectory of 
your source root:

   mkdir my_build
   cd my_build
   cmake ..
   make


> On Sep 9, 2016, at 8:17 AM, Vania Joloboff  wrote:
> 
> Hi,
> 
> I have started to use CMake for my software.
> I build in a separate directory using :
> $> cmake -G "Unix Makefiles"  
> 
> Everything is built correctly and the software works fine.
> However all of my source code directories get polluted.
> Into each source directory, a new Makefile is created.
> All of these Makefiles are identical. They are
> 
> -
> # Generated by cpputils-cmake.
> include /flags.make
> .PHONY: check-syntax
> check-syntax:
>${CC} -o /dev/null ${C_FLAGS} ${C_DEFINES} -I/usr/src/linux/include 
> -DNDEBUG -S ${CHK_SOURCES}
> 
> 
> Any clue ??
> 
> 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] Time each target

2016-08-25 Thread Michael Ellery

> On Aug 25, 2016, at 9:58 AM, Moreland, Kenneth  wrote:
> 
> Does anyone know of a simple way to get CMake to time how long it takes to 
> compile each target? As it stands now, when compiling a CMake-managed project 
> a status is printed before each target is built. What I am looking for is a 
> way to get CMake to print a second status message after the target finishes 
> building with a note on what the wall time of the build was.
>  
> -Ken
>  

I don’t know of any built-in support for this. I think Visual Studio projects 
might have a setting to generate timing info, but I suspect you are not using 
Visual Studio/MSbuild.

Here is an example of some build timing:

https://github.com/PointCloudLibrary/pcl/blob/master/CMakeLists.txt#L98
https://github.com/PointCloudLibrary/pcl/blob/master/cmake/custom_output.sh

..but I think it is providing timing for each compile command, not at the 
target level. In any event, this technique of using RULE_LAUNCH_COMPILE seems 
interesting - perhaps you can adopt it somehow.

The only other thing I can think of is to add custom targets around your real 
targets where  POST depends on REAL which DEPENDS on PRE and the PRE and POST 
targets just print some timing info. Kludgy to be sure. HTH.

-Mike

-- 

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] unexpected behavior with TARGET_FILE_DIR and Visual Studio 2010

2014-12-05 Thread Michael Ellery
Hi cmake-users,
 
I have the following setup:

CMAKE: 3.0.2
Visual Studio 2010

In one of my cmake files, I’m trying to create a preprocessor definition based 
on the TARGET_FILE_DIR of a different target … so I’m trying this:

target_compile_definitions(my_target_B PUBLIC 
  -DTARGET_A_DIR=$TARGET_FILE_DIR:my_target_A 
)

When I run this for my visual studio build (2010), I get the following settings 
created in the project file:

test/my_target_B.vcxproj:95:  
PreprocessorDefinitionsWIN32;_WINDOWS;_DEBUG;_DEBUG;TARGET_A_DIR=Y:/work/some_lib/bld_win/src/my_target_A/Debug;CMAKE_INTDIR=Debug;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:99:  
PreprocessorDefinitionsWIN32;_WINDOWS;_DEBUG;_DEBUG;TARGET_A_DIR=\Y:/work/some_lib/bld_win/src/my_target_A/Debug\;CMAKE_INTDIR=\Debug\;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:392:  
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=Y:/work/some_lib/bld_win/src/my_target_A/Debug;CMAKE_INTDIR=Release;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:396:  
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=\Y:/work/some_lib/bld_win/src/my_target_A/Debug\;CMAKE_INTDIR=\Release\;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:689:  
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=Y:/work/some_lib/bld_win/src/my_target_A/Debug;CMAKE_INTDIR=MinSizeRel;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:693:  
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=\Y:/work/some_lib/bld_win/src/my_target_A/Debug\;CMAKE_INTDIR=\MinSizeRel\;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:986:  
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=Y:/work/some_lib/bld_win/src/my_target_A/Debug;CMAKE_INTDIR=RelWithDebInfo;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:990:  
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=\Y:/work/some_lib/bld_win/src/my_target_A/Debug\;CMAKE_INTDIR=\RelWithDebInfo\;%(PreprocessorDefinitions)/PreprocessorDefinitions

in other words, it looks like the generator expression is only being evaluated 
once (as Debug) and then used for ALL of the build configs in the visual studio 
project.  This isn’t exactly what I want since I need the actual output dir for 
each config to be the correct one for that build type.

This same thing works fine on my linux/makefile build since the output dir is 
the same for all builds.

Can anyone offer advice? Is this how the visual studio generator works or is 
this possibly a bug in CMake?

Thanks,
Mike


signature.asc
Description: Message signed with OpenPGP using GPGMail
-- 

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