Re: [CMake] configure_file as a build step?

2012-05-01 Thread Michael Wild
You can configure_file() a CMake-script which itself then performs the
configure_file() in a custom command. E.g.:


# CMakeLists.txt:
#...
set(FOO "Some text to show up in json_file.json")
set(BAR "More text")
configure_file(configure_json_file.cmake.in
  ${CMAKE_CURRENT_BINARY_DIR}/configure_json_file.cmake @ONLY)

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/json_file.json
  COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/configure_json_file.cmake
  DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/configure_json_file.cmake
${CMAKE_CURRENT_SOURCE_DIR}/json_file.json.in
  COMMENT "Configuring json_file.json"
  VERBATIM)

add_custom_target(configure_json ALL
  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/json_file.json)
#...
# EOF


# configure_json_file.cmake.in:
set(SRC_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(BIN_DIR "@CMAKE_CURRENT_BINARY_DIR@")
set(FOO "@FOO@")
set(BAR "@BAR@")
configure_file(${SRC_DIR}/json_file.json.in
  ${BIN_DIR}/json_file.json @ONLY)
# EOF


HTH

Michael

On 05/02/2012 01:16 AM, Jensen, Erik A wrote:
> I have a JSON file that needs to have some values set based on the
> project’s configuration. During development, this file can change rather
> frequently.
> 
>  
> 
> Currently, I am using configure_file to fill in the required values.
> Unfortunately, every time the file is modified, it triggers CMake to do
> a complete configuration and generation step. This slows down rebuilds,
> and is especially problematic when using Visual Studio, where the
> solution has to be reloaded after it is regenerated.
> 
>  
> 
> Is there any way to have the file generated as part of the build instead
> of part of the configuration/generation step?
> 
>  
> 
> Thanks,
> 
> -- Erik
> 
> 
> 
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

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

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

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


Re: [CMake] math(EXPR) and unary operators

2012-05-01 Thread cowwoc

   Apparently this issue is 3 years old:
http://public.kitware.com/Bug/view.php?id=8996

Gili


Rolf Eike Beer wrote
> 
> George Koehler wrote:
>> math(EXPR) rejects expressions with negative numbers. This is awful
>> because math() can reject its own negative results. For example, this
>> code fails:
>> 
>>   math(EXPR negative "1 - 2")
>>   math(EXPR sum "100 + ${negative}")
> 
> If you are touching this file anyway, do you see any chance of teaching it
> to 
> deal with hex numbers, too? When dealing with the OpenSSL version defines
> I 
> found out that this is currently not supported.
> 
> Eike
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> 


--
View this message in context: 
http://cmake.3232098.n2.nabble.com/math-EXPR-and-unary-operators-tp7350163p7518780.html
Sent from the CMake mailing list archive at Nabble.com.
--

Powered by www.kitware.com

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

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

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


[CMake] configure_file as a build step?

2012-05-01 Thread Jensen, Erik A
I have a JSON file that needs to have some values set based on the project's 
configuration. During development, this file can change rather frequently.

Currently, I am using configure_file to fill in the required values. 
Unfortunately, every time the file is modified, it triggers CMake to do a 
complete configuration and generation step. This slows down rebuilds, and is 
especially problematic when using Visual Studio, where the solution has to be 
reloaded after it is regenerated.

Is there any way to have the file generated as part of the build instead of 
part of the configuration/generation step?

Thanks,
-- Erik
--

Powered by www.kitware.com

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

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

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

Re: [CMake] CMake 2.8.8 bug with cmake-gui and stop button

2012-05-01 Thread David Cole
It's a bug. You should not be able to generate unless a configure step
has *completed* successfully.

A good demonstration of the fact that GUI changes are hard to test.


On Tue, May 1, 2012 at 4:35 PM, Robert Dailey  wrote:
> Remember that change that was made to make pressing stop in cmake-gui more
> responsive? I'm finding an issue now where during configure, if I stop, it
> stops without failing, which allows me to press generate on a partial
> configuration. I'm not sure if this is a bug of feature but I thought I'd
> mention it. I output text in my CMake scripts for each target I create and
> configure:
>
> Checking for new third party libraries (might take a few minutes)...
>
> _copy_dlls being generated (may take a while)
>
> BUILD_VERSION is: 6.3.2.14
>
> + testharness --> common/testharness/CMakeLists.txt
>
> + gdutil --> common/util/CMakeLists.txt
>
> Configuring done
>
> Generating done
>
>
> I pressed stop and nothing failed after configuring 'gdutil' target. I have
> at least 100 other targets that are supposed to generate after that.
> Thoughts?
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
--

Powered by www.kitware.com

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

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

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


[CMake] CMake 2.8.8 bug with cmake-gui and stop button

2012-05-01 Thread Robert Dailey
Remember that change that was made to make pressing stop in cmake-gui more
responsive? I'm finding an issue now where during configure, if I stop, it
stops without failing, which allows me to press generate on a partial
configuration. I'm not sure if this is a bug of feature but I thought I'd
mention it. I output text in my CMake scripts for each target I create and
configure:

Checking for new third party libraries (might take a few minutes)...

_copy_dlls being generated (may take a while)

BUILD_VERSION is: 6.3.2.14

 + testharness --> common/testharness/CMakeLists.txt

+ gdutil --> common/util/CMakeLists.txt

Configuring done

Generating done


I pressed stop and nothing failed after configuring 'gdutil' target. I have
at least 100 other targets that are supposed to generate after that.
Thoughts?
--

Powered by www.kitware.com

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

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

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

Re: [CMake] [Boost-users] link error in Visual Studio when using boost from CMake

2012-05-01 Thread Hui Wang
Yes, target_link_libraries works well, I had problem before because I used
find_package(Boost) instead of find_package(Boost COMPONENTS thread), so
when I used target_link_libraries( MyProject ${Boost_LIBRARIES} ), it
didn't link anything, after I specify the components in find_package, it
has no problem.

On Tue, May 1, 2012 at 11:47 AM, Michael Jackson <
mike.jack...@bluequartz.net> wrote:

>
> On May 1, 2012, at 11:37 AM, Mourad Boufarguine wrote:
>
> >
> > On Tue, May 1, 2012 at 9:10 AM, Rolf Eike Beer  wrote:
> > On Di.,   1. Mai. 2012 00:20:58 CEST, Mourad Boufarguine <
> mou...@boufarguine.name> wrote:
> >
> > > Hi,
> > >
> > > add this :
> > >
> > > link_directories(${Boost_LIBRARY_DIRS})
> > >
> > > after the include_directories command.
> >
> > No, please don't. The target_link_libraries command is what you really
> want. Please stop advertising link_directories, it's usage is almost
> certainly wrong and while it sometimes seems to solve your problem it
> usually just creates another one.
> >
> > Eike
> > --
> >
> >
> >
> > Unless you disable Boost auto-linking, i'm afraid it's the only option.
> Boost autolinking is enabled by default for Visual Studio. In this case,
> Boost headers have pragmas to link to Boost libs.
> >
> > #pragma comment (lib, "libboost_.lib")
> >
> > If you don't add  Boost_LIBRARY_DIRS  to the link directories, it won't
> work.
> >
> > Mourad
> >
>
> Nope. I don't use link_directories at all and I use Boost on windows all
> the time. I use the "target_link_libraries(...) method and it has NEVER
> give me any trouble on windows with VS 2005, 2008 and 2010.
>
> YMMV (but it shouldn't)
> ---
> Mike Jackson www.bluequartz.net
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Sophie Wang
www.sophiehuiwang.com
--

Powered by www.kitware.com

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

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

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

Re: [CMake] [Boost-users] link error in Visual Studio when using boost from CMake

2012-05-01 Thread Michael Jackson

On May 1, 2012, at 11:37 AM, Mourad Boufarguine wrote:

> 
> On Tue, May 1, 2012 at 9:10 AM, Rolf Eike Beer  wrote:
> On Di.,   1. Mai. 2012 00:20:58 CEST, Mourad Boufarguine 
>  wrote:
> 
> > Hi,
> >
> > add this :
> >
> > link_directories(${Boost_LIBRARY_DIRS})
> >
> > after the include_directories command.
> 
> No, please don't. The target_link_libraries command is what you really want. 
> Please stop advertising link_directories, it's usage is almost certainly 
> wrong and while it sometimes seems to solve your problem it usually just 
> creates another one.
> 
> Eike
> --
> 
> 
> 
> Unless you disable Boost auto-linking, i'm afraid it's the only option. Boost 
> autolinking is enabled by default for Visual Studio. In this case, Boost 
> headers have pragmas to link to Boost libs.
> 
> #pragma comment (lib, "libboost_.lib")
> 
> If you don't add  Boost_LIBRARY_DIRS  to the link directories, it won't work.
> 
> Mourad
> 

Nope. I don't use link_directories at all and I use Boost on windows all the 
time. I use the "target_link_libraries(...) method and it has NEVER give me any 
trouble on windows with VS 2005, 2008 and 2010.

YMMV (but it shouldn't)
---
Mike Jackson www.bluequartz.net

--

Powered by www.kitware.com

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

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

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


Re: [CMake] [Boost-users] link error in Visual Studio when using boost from CMake

2012-05-01 Thread Mourad Boufarguine
On Tue, May 1, 2012 at 9:10 AM, Rolf Eike Beer  wrote:

> On Di.,   1. Mai. 2012 00:20:58 CEST, Mourad Boufarguine <
> mou...@boufarguine.name> wrote:
>
> > Hi,
> >
> > add this :
> >
> > link_directories(${Boost_LIBRARY_DIRS})
> >
> > after the include_directories command.
>
> No, please don't. The target_link_libraries command is what you really
> want. Please stop advertising link_directories, it's usage is almost
> certainly wrong and while it sometimes seems to solve your problem it
> usually just creates another one.
>
> Eike
> --
>
>
>
Unless you disable Boost auto-linking, i'm afraid it's the only option.
Boost autolinking is enabled by default for Visual Studio. In this case,
Boost headers have pragmas to link to Boost libs.

#pragma comment (lib, "libboost_.lib")

If you don't add  Boost_LIBRARY_DIRS  to the link directories, it won't
work.

Mourad
--

Powered by www.kitware.com

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

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

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

Re: [CMake] [Boost-users] link error in Visual Studio when using boost from CMake

2012-05-01 Thread Rolf Eike Beer
On Di.,   1. Mai. 2012 00:20:58 CEST, Mourad Boufarguine 
 wrote:

> Hi,
> 
> add this :
> 
> link_directories(${Boost_LIBRARY_DIRS})
> 
> after the include_directories command.

No, please don't. The target_link_libraries command is what you really want. 
Please stop advertising link_directories, it's usage is almost certainly wrong 
and while it sometimes seems to solve your problem it usually just creates 
another one.

Eike 
--

Powered by www.kitware.com

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

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

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