Re: [CMake] Possible to modify COMPILE_FLAGS?

2011-10-25 Thread Campbell Barton
Thanks for that, from reading the docs now this is more clear but for
some reason I had the impression the flags on a file could be
manipulated.

# ---
# Heres the macro I came up with to disable certain warnings for a
given set of files...

macro(remove_strict_flags_file
filenames)

foreach(_SOURCE ${ARGV})

if(CMAKE_COMPILER_IS_GNUCC)
set_source_files_properties(${_SOURCE}
PROPERTIES
COMPILE_FLAGS 
"-Wno-deprecated-declarations"
)
endif()

if(MSVC)
# TODO
endif()

endforeach()

unset(_SOURCE)

endmacro()

# ---
# Example use

remove_strict_flags_file(
intern/indexer.c
intern/util.c
intern/anim_movie.c
)



On Tue, Oct 25, 2011 at 7:16 PM, Michael Wild  wrote:
> On 10/25/2011 09:51 AM, Campbell Barton wrote:
>> The problem I'm trying to solve is to have "-Werror" for the whole
>> project except a few files which include system headers that give
>> warnings we can't workaround (even with -isystem).
>>
>> So I'm trying to get cmake to replace some flags for a specific file,
>> and I ran into the problem that the variable appears not to be set.
>>
>> get_source_file_property(MYVAR intern/BME_Customdata.c COMPILE_FLAGS)
>> ... modify the MYVAR
>> ... set the flags back
>>
>> But the variable isnt set, Im sure the source file is valid because I
>> printed it from the list passed to the target, and I tried this before
>> and after defining the source file in the target:
>> message(FATAL_ERROR "Check: ${MYVAR}")
>> Check: NOTFOUND
>>
>>
>> I'm guessing the COMPILE_FLAGS property can be set which overrides the
>> default flags but is there a good way to manipulate the existing
>> flags?
>>
>
> Problem is, that the COMPILE_FLAGS property only *appends* to the
> default compile flags. You'll have to remove -Werror from
> CMAKE__FLAGS[_] variables and set it instead on all the
> files you want it to be set for.
>
> Michael
> --
>
> 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
>



-- 
- Campbell
--

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] Possible to modify COMPILE_FLAGS?

2011-10-25 Thread Campbell Barton
The problem I'm trying to solve is to have "-Werror" for the whole
project except a few files which include system headers that give
warnings we can't workaround (even with -isystem).

So I'm trying to get cmake to replace some flags for a specific file,
and I ran into the problem that the variable appears not to be set.

get_source_file_property(MYVAR intern/BME_Customdata.c COMPILE_FLAGS)
... modify the MYVAR
... set the flags back

But the variable isnt set, Im sure the source file is valid because I
printed it from the list passed to the target, and I tried this before
and after defining the source file in the target:
message(FATAL_ERROR "Check: ${MYVAR}")
Check: NOTFOUND


I'm guessing the COMPILE_FLAGS property can be set which overrides the
default flags but is there a good way to manipulate the existing
flags?

-- 
- Campbell
--

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] Problems with FindPythonInterp

2011-10-11 Thread Campbell Barton
On Tue, Oct 11, 2011 at 10:50 PM, Yngve Inntjore Levinsen
 wrote:
> Fredag 07 oktober 2011 skrev Yngve Inntjore Levinsen:
>> Dear all,
>>
>> I have some configuration scripts in python that needs to be run for my
>> project, so I use the FindPythonInterp package. This has nicely found the
>> version 2.7 on my system so far, but now it suddenly finds /usr/bin/python
>> which is a soft link to version 3.2. My script doesn't work with python 3.
>>
>> First: Is it possible to set a requirement that it should be python version
> 2?
>>
>> Second: This for some weird reason only happens on my desktop, even though I
>> have pretty much exactly the same setup on my laptop. On my laptop it finds
>> /usr/bin/python2.7 (as it always has). They both have the same python
> versions
>> installed (2.7 and 3.2), and they both have the same cmake version installed
>> (2.8.6). I am running Arch Linux.
>>
>> On my laptop:
>> -- Found PythonInterp: /usr/bin/python2.7
>> On my desktop:
>> -- Found PythonInterp: /usr/bin/python (found version "3.2.2")
>>
>> I'm sure there must be some differences in what's installed on the two
> systems,
>> but I cannot figure out what.
>>
>> I tried
>> find_package(PythonInterp 2.7 REQUIRED)
>> but that still found the 3.2 version and only commented that 2.7 was
> required.
>>
>> Let me know if I can provide further information.
>>
>> Cheers,
>> Yngve
>
> Hi,
>
> I did not receive any response to my mail. Here is the solution which was the
> best I could come up with:
>
> First, I made a copy of each of the python scripts and gave them new names
> with "_py3" at the end. I converted those to python 3 syntax (2to3 helps you
> quite a bit to get started). Then I added the following in my cmake script:
>
> if(PYTHON_VERSION_MAJOR)
>    if(${PYTHON_VERSION_MAJOR} EQUAL 3)
>        set(PYSCRPT_END "_py3")
>    endif()
> endif()
>
> Finally I added ${PYSCRPT_END} to all python script names where they occured
> in the cmake scripts. That way cmake chooses the correct scripts
> automatically, which is a good enough solution for me.
>
> I would say though, I'd recommend that you create a way to require python 2.
> It isn't as easy for everyone to rewrite their code, some needed libraries
> might be missing. It is stupid if cmake cannot be used on systems where both
> python 2 and python 3 are installed for this rather simple reason.
>
> Cheers,
> Yngve
> --
> 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
>

Proper python3 support (which allows selecting python2 also), is not
trivial I think because it needs to support ABI flags for 3.2+, and no
ABI flags for previous versions (cant recall which version exactly API
flags were added).

Since CMake currently only supports python2.x some quick fix not to
select "python" binary which is version 3.x should be pretty easy.

On a similar topic, I maintain a py3.x find module which supports ABI
flags, perhaps helpful for updating CMake's support for py3:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/cmake/Modules/FindPythonLibsUnix.cmake

-- 
- Campbell
--
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] Getting the source file list for an executable fails

2011-09-17 Thread Campbell Barton
On Sat, Sep 17, 2011 at 10:36 AM, Michael Hertling  wrote:
> On 09/16/2011 03:24 AM, Campbell Barton wrote:
>> On Fri, Sep 16, 2011 at 11:11 AM, Michael Hertling  
>> wrote:
>>> On 09/16/2011 02:59 AM, Campbell Barton wrote:
>>>> Hi, I would expect this would work from reading the docs but it gives
>>>>
>>>>       add_executable(mytarget ${SRC})
>>>>       get_property(TESTPROP_A TARGET mytarget PROPERTY SOURCE)
>>>>         get_target_property(TESTPROP_B mytarget SOURCE)
>>>>       message(FATAL_ERROR "Testing ${TESTPROP_A}, ${TESTPROP_B}")
>>>>
>>>> The output I get is:
>>>>
>>>> Testing '', 'TESTPROP_B-NOTFOUND'
>>>>
>>>> This is odd since properties "TYPE" and "LOCATION" are found
>>>>
>>>> Obviously in this case ${SRC} is already available, but I'm just
>>>> trying to figure out why it fails.
>>>>
>>>> tested on cmake 2.8.5
>>>
>>> The property you probably refer to is named SOURCES, not SOURCE. The
>>> different results returned by GET_PROPERTY() and GET_TARGET_PROPERTY()
>>> are documented: The former returns an empty value if the property isn't
>>> set, and the latter returns the NOTFOUND value, both evaluating to FALSE.
>>>
>>> Regards,
>>>
>>> Michael
>>
>> Ack!, sorry for the dumb mistake, but now I'm faced with a different problem.
>>
>> Getting the sources for a library defined in another directory, and it
>> gives me relative paths.
>>
>> How do you get the path a library is defined in so I can make the
>> absolute paths? - tried LOCATION but this gives the output location.
>> PREFIX, SUFFIX are not set.
>
> AFAIK, CMake doesn't provide a mean to achieve this, so you must DIY:
>
> # CMakeLists.txt:
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
> PROJECT(TARGETSOURCES C)
> SET(CMAKE_VERBOSE_MAKEFILE ON)
>
> FUNCTION(SET_TARGET_DIRECTORIES TARGET)
>    SET_TARGET_PROPERTIES(
>        ${TARGET}
>        PROPERTIES
>        TARGET_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
>        TARGET_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
> ENDFUNCTION()
>
> FUNCTION(GET_TARGET_SOURCES TARGET RESULT)
>    GET_PROPERTY(HASSRCDIR
>        TARGET ${TARGET}
>        PROPERTY TARGET_SOURCE_DIR SET)
>    GET_PROPERTY(HASBINDIR
>        TARGET ${TARGET}
>        PROPERTY TARGET_BINARY_DIR SET)
>    IF(HASSRCDIR AND HASBINDIR)
>        GET_TARGET_PROPERTY(SRCDIR ${TARGET} TARGET_SOURCE_DIR)
>        GET_TARGET_PROPERTY(BINDIR ${TARGET} TARGET_BINARY_DIR)
>        GET_TARGET_PROPERTY(SRCS ${TARGET} SOURCES)
>        UNSET(SOURCES)
>        FOREACH(i IN LISTS SRCS)
>            IF(IS_ABSOLUTE ${i})
>                LIST(APPEND SOURCES ${i})
>            ELSEIF(EXISTS ${SRCDIR}/${i})
>                LIST(APPEND SOURCES ${SRCDIR}/${i})
>            ELSEIF(EXISTS ${BINDIR}/${i})
>                LIST(APPEND SOURCES ${BINDIR}/${i})
>            ENDIF()
>        ENDFOREACH()
>        SET(${RESULT} ${SOURCES} PARENT_SCOPE)
>    ENDIF()
> ENDFUNCTION()
>
> ADD_SUBDIRECTORY(xyz)
> FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n")
> ADD_EXECUTABLE(main main.c)
> TARGET_LINK_LIBRARIES(main xyz)
> GET_TARGET_SOURCES(xyz SOURCES)
> MESSAGE("SOURCES: ${SOURCES}")
>
> # xyz/CMakeLists.txt:
> FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/x.c "void x(void){}\n")
> FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/y.c "void y(void){}\n")
> FILE(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/y.c "void y(void){}\n")
> FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/z.c "void z(void){}\n")
> FILE(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/z.c "void z(void){}\n")
> FILE(WRITE /tmp/z.c "void z(void){}\n")
> ADD_LIBRARY(xyz SHARED x.c y.c /tmp/z.c)
> SET_TARGET_DIRECTORIES(xyz)
>
> The SET_TARGET_DIRECTORIES() function records a target's source/binary
> directories as user-defined target properties and must be invoked from
> within the concerned target's CMakeLists.txt. The GET_TARGET_SOURCES()
> function reconstructs the list of a target's sources with full paths
> based on the above-noted target properties. Compare the contents of
> the SOURCES variable with Make's output to see that the precedence of
> absolute paths over the source directory and the latter's precedence
> over the binary directory in ADD_EXECUTABLE/LIBRARY() is respected.
>
> 'hope that helps.
>
> Regards,
>
> Michael


Thanks for the example, but pe

Re: [CMake] Getting the source file list for an executable fails

2011-09-15 Thread Campbell Barton
On Fri, Sep 16, 2011 at 11:11 AM, Michael Hertling  wrote:
> On 09/16/2011 02:59 AM, Campbell Barton wrote:
>> Hi, I would expect this would work from reading the docs but it gives
>>
>>       add_executable(mytarget ${SRC})
>>       get_property(TESTPROP_A TARGET mytarget PROPERTY SOURCE)
>>         get_target_property(TESTPROP_B mytarget SOURCE)
>>       message(FATAL_ERROR "Testing ${TESTPROP_A}, ${TESTPROP_B}")
>>
>> The output I get is:
>>
>> Testing '', 'TESTPROP_B-NOTFOUND'
>>
>> This is odd since properties "TYPE" and "LOCATION" are found
>>
>> Obviously in this case ${SRC} is already available, but I'm just
>> trying to figure out why it fails.
>>
>> tested on cmake 2.8.5
>
> The property you probably refer to is named SOURCES, not SOURCE. The
> different results returned by GET_PROPERTY() and GET_TARGET_PROPERTY()
> are documented: The former returns an empty value if the property isn't
> set, and the latter returns the NOTFOUND value, both evaluating to FALSE.
>
> Regards,
>
> Michael

Ack!, sorry for the dumb mistake, but now I'm faced with a different problem.

Getting the sources for a library defined in another directory, and it
gives me relative paths.

How do you get the path a library is defined in so I can make the
absolute paths? - tried LOCATION but this gives the output location.
PREFIX, SUFFIX are not set.
___
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] Getting the source file list for an executable fails

2011-09-15 Thread Campbell Barton
Hi, I would expect this would work from reading the docs but it gives

add_executable(mytarget ${SRC})
get_property(TESTPROP_A TARGET mytarget PROPERTY SOURCE)
get_target_property(TESTPROP_B mytarget SOURCE)
message(FATAL_ERROR "Testing ${TESTPROP_A}, ${TESTPROP_B}")

The output I get is:

Testing '', 'TESTPROP_B-NOTFOUND'

This is odd since properties "TYPE" and "LOCATION" are found

Obviously in this case ${SRC} is already available, but I'm just
trying to figure out why it fails.

tested on cmake 2.8.5

-- 
- Campbell
___
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] FYI - From Ninja-build mailing list - Fwd: Proposal: restat rules

2011-09-08 Thread Campbell Barton
Tested cmake/ninja with Blender's cmake files, works well, and fast!
Single file rebuild is 0.97 sec, same on makefiles was 3.7sec.

btw, we do something similar to LLVM with generating source, only
updating if it changes, however only for C files not headers, ninja
handles this ok for my quick tests editing files and rebuilding.

Looking forward to having this in stable cmake!

On Fri, Sep 9, 2011 at 4:54 AM, Peter Collingbourne  wrote:
> On Wed, Sep 07, 2011 at 11:04:42PM -0400, Jean-Christophe Fillion-Robin wrote:
>> -- Forwarded message --
>> From: Peter Collingbourne 
>> Date: Wed, Sep 7, 2011 at 9:17 PM
>> Subject: Proposal: restat rules
>> To: ninja-bu...@googlegroups.com
>
> FWIW, the Ninja generator I have been working on is based on work by
> Nicolas Despres, and has been successfully used to compile a number
> of large open source projects, including CMake itself, LLVM/Clang,
> OpenCV and Bullet Physics.
>
> I am planning to submit the Ninja generator as a patch to CMake
> upstream once it has been put through more exhaustive testing and
> certain known issues have been resolved (my post to ninja-build being
> one of them).
>
> Anyone who is interested in trying the Ninja generator with
> their own projects is welcome to clone my repository at:
>
> https://github.com/pcc/CMake/tree/ninja-generator
>
> and to report any issues encountered.  Note that the generator is
> currently only known to work on Linux.  To select the Ninja generator
> you can pass the option "-G Ninja" on the cmake command line.
>
> Thanks,
> --
> Peter
> ___
> 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
>



-- 
- Campbell
___
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] GTK2's include broken with recent cairomm (patch)

2011-06-24 Thread Campbell Barton
Hi, I found that building inkscape with cairomm would fail because
cairommconfig.h could not be found (which cairomm.h includes),

Heres a 1 line patch to fix the problem.

Also reported bug, but not sure if its necessary.
http://cmake.org/Bug/view.php?id=12306

-- 
- Campbell
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index a03c023..1efa3e6 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -471,6 +471,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
 _GTK2_FIND_LIBRARY(GTK2_GTKMM_LIBRARY gtkmm true true)
 
 _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM_INCLUDE_DIR cairomm/cairomm.h)
+_GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG_INCLUDE_DIR cairommconfig.h)
 _GTK2_FIND_LIBRARY(GTK2_CAIROMM_LIBRARY cairomm true true)
 
 _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM_INCLUDE_DIR pangomm.h)
___
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] determine 32 vs 64 bit linux

2011-06-22 Thread Campbell Barton
On Wed, Jun 22, 2011 at 11:33 PM, Karl Merkley  wrote:
>
> I need to install a library into a directory whose name depends on the 
> machine type.   For example
>
> if (WIN32)
>  if (CMAKE_CL_64)
>      set(ARCH_DIR "win32")
>  else()
>      set(ARCH_DIR "win64")
>  endif()
>
> elseif (UNIX)
>  if ()
>      set(ARCH_DIR "linux32")
>  else()
>     set(ARCH_DIR "linux64")
> endif()
>
> Is there a better way to do this?   The win64 version seems to work 
> correctly.   What variable do I check for 32 vs 64 bit linux?
>
>  Thanks,
>        Karl

Not sure this is the best way but its used in cmake files a bit.

if(CMAKE_SIZEOF_VOID_P EQUAL 8)

___
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 consistency checker utility

2011-06-21 Thread Campbell Barton
Writing to the list since some of you may find a script useful that I
have been developing for a while now.
I'm using this script to help maintain source files for inkscape
~2000 files, and blender3d ~4000 files.

With large, portable projects is its hard to keep track of all files
on an active code-base where branches are merged and files move about,
generally as long as its building missing files pass unnoticed.
The problem with _not_ including some files is that an IDE will miss
headers when searching source files this gives trouble for refactoring
code and generally a nuisance.

So I wrote a script which checks all source files are accounted for,
it uses a weak kind of parsing but it has the advantage that source
files from all configurations are included.

It works by assuming that variables with suffix "_SRC" and "_INC" are
are source variables, and recognizes set(), and list(APPEND ...)
commands.

The script builds a list of all source files CMake knows about,
compares with all source files on disk, and warns on any mismatch,
files which are intentionally left out need to be added to an ignore
list.


The main script:
 
https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/cmake/cmake_consistency_check.py

Project Specific Configuration:
 
https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/cmake/cmake_consistency_check_config.py

-- 
- Campbell
___
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] FindOpenEXR.cmake inclusion in cmake modules?

2011-06-16 Thread Campbell Barton
2011/6/16 Alexander Neundorf :
> On Thursday 16 June 2011, David Cole wrote:
>> First, ask if the module is really necessary. If, instead, you can add an
>> OpenEXRConfig.cmake file to the OpenEXR project itself, and install it in a
>> place that cmake's find_package will automatically find it, then a find
>> module is unnecessary.
>>
>> However, if that's not possible or practical, then...
>>
>> Follow the directions here on becoming a module maintainer:
>>
>>   http://www.cmake.org/Wiki/CMake:Module_Maintainers
>>
>> If anything is unclear, ask here for clarification.
>>
>>
>> Thanks,
>> David

Is writing a ***Config.cmake file documented?, does this rely on
OpenEXR using cmake for their builds?
I wasn't aware of this.

>> On Wed, Jun 15, 2011 at 11:25 PM, Campbell Barton
> wrote:
>> > Recently I decided to start moving some of our projects hard coded
>> > paths into Find***.cmake modules.
>> >
>> > Incidentally the libs are libsamplerate, libFFTW3, libsndfile,
>> > libjemalloc, OpenEXR, OpenJPEG, libpcre.
>> >
>> > I started out with OpenEXR, and tried to comply with the module
>> > readme.txt, and used FindTIFF/Boost/OpenGL as references too.
>> >
>> > Heres the module,
>> >
>> > https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/cmak
>> > e/Modules/FindOpenEXR.cmake
>
> I think you should not need to set _openexr_SEARCH_DIRS, I think all these
> paths are included in the standard search paths.

does this work for FIND_PATH as well as FIND_LIBRARY?

>> >
>> > _after_ writing this I found that there are 3 other projects who also
>> > wrote their own FindOpenEXR.cmake modules,
>> >
>> >
>> > http://code.google.com/p/nvidia-texture-tools/source/browse/trunk/cmake/F
>> > indOpenEXR.cmake?r=HEAD
>> >
>> > http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/C
>> > MakeModules/FindOpenEXR.cmake?rev=HEAD
>> > http://www.openlibraries.org/browser/trunk/FindOpenEXR.cmake
>
> And another one:
> http://quickgit.kde.org/?p=kdelibs.git&a=blob&h=405b892d436823ac3b102b4eb0a1126bc168aec7&hb=9be5b41d4e933d019d3d30cead9143b3703d10f4&f=cmake/modules/FindOpenEXR.cmake
>
> Alex

Noticed KDE's FineOpenEXR.cmake uses pkg-config, Is this considered
best practice?

-- 
- Campbell
___
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] FindOpenEXR.cmake inclusion in cmake modules?

2011-06-15 Thread Campbell Barton
Recently I decided to start moving some of our projects hard coded
paths into Find***.cmake modules.

Incidentally the libs are libsamplerate, libFFTW3, libsndfile,
libjemalloc, OpenEXR, OpenJPEG, libpcre.

I started out with OpenEXR, and tried to comply with the module
readme.txt, and used FindTIFF/Boost/OpenGL as references too.

Heres the module,
https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/cmake/Modules/FindOpenEXR.cmake

_after_ writing this I found that there are 3 other projects who also
wrote their own FindOpenEXR.cmake modules,

http://code.google.com/p/nvidia-texture-tools/source/browse/trunk/cmake/FindOpenEXR.cmake?r=HEAD
http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/CMakeModules/FindOpenEXR.cmake?rev=HEAD
http://www.openlibraries.org/browser/trunk/FindOpenEXR.cmake

>From a quick look at all of them I'm not worried that I wrote my own
since they don't support defining a custom root or follow cmake's
guidelines very well,
The main issue with mine is it only works on *nix right now, so MSVC
support has to be added (which I will add).

If OpenEXR is not considered too niche a library which to bother including,
whats the best way to get this module included with CMake?

-- 
- Campbell
___
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] include_directories(SYSTEM, GNU.cmake and -isystem for C (not CXX)

2011-06-10 Thread Campbell Barton
To follow up on this, I tested this on a test project and found the
problem was in my own macro which wasn't initializing an include list.
So only the  set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ") remains
which should be fixed in CMake but is easy to workaround.

On Thu, Jun 9, 2011 at 10:59 PM, Michael Hertling  wrote:
> On 06/08/2011 07:26 AM, Campbell Barton wrote:
>> There were some system headers giving warnings compiling on linux,
>> since I like to have warnings as errors, and not edit system headers,
>> I used:
>>  include_directories(SYSTEM dir1 dir2 ...)
>> ... for system directories only.
>>
>> However this does not result in -isystem being used in C because
>> GNU.cmake does not set:
>>  set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
>> ... as it does for C++.
>
> On my system, I can confirm that. AFAICS, it's caused by the macro
> "__compiler_gnu" in ${CMAKE_ROOT}/Modules/Compiler/GNU.cmake; this
> macro is parameterized with the argument "lang" for the language,
> but for the "-isystem" option, it reads
>
> set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
>
> i.e., the "-isystem" option is enabled statically for C++ only,
> regardless of the "lang" argument. Shouldn't this line read
>
> set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
>
> instead, i.e. "-isystem" for each "lang"?
>
>> I tried adding this directly after the project(), call (beforehand it
>> fails to have any effect):
>>
>>       if(CMAKE_COMPILER_IS_GNUCC)
>>               if(NOT APPLE)
>>                       set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
>>               endif()
>>       endif()
>>
>>
>> So now it almost works, but I've noticed that If
>> "include_directories(SYSTEM" is called after a non system include, ALL
>> includes then use -isystem.
>>
>> Putting "include_directories(SYSTEM" first mostly works out OK, but I
>> found a few cases where the order isn't so easy to set in our own
>> CMakeLists.txt and still incorrectly uses -isystem where it shouldn't.
>> Also found using the BEFORE / AFTER arguments to include_directories(
>> doesn't make any difference to the use of -isystem.
>
> This, however, I can't confirm. Could you provide an example?
>
>> Is this a known problem or is there a way to get this working?
>
> If you tweak the above-noted line in GNU.cmake, i.e. replace CXX with
> ${lang}, things work as expected at the first glance. This issue does
> not seem to be correct, so I think your bug report is justified.
>
> Regards,
>
> Michael
> ___
> 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
>



-- 
- Campbell
___
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] include_directories(SYSTEM, GNU.cmake and -isystem for C (not CXX)

2011-06-07 Thread Campbell Barton
There were some system headers giving warnings compiling on linux,
since I like to have warnings as errors, and not edit system headers,
I used:
 include_directories(SYSTEM dir1 dir2 ...)
... for system directories only.

However this does not result in -isystem being used in C because
GNU.cmake does not set:
 set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
... as it does for C++.

I tried adding this directly after the project(), call (beforehand it
fails to have any effect):

if(CMAKE_COMPILER_IS_GNUCC)
if(NOT APPLE)
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
endif()
endif()


So now it almost works, but I've noticed that If
"include_directories(SYSTEM" is called after a non system include, ALL
includes then use -isystem.

Putting "include_directories(SYSTEM" first mostly works out OK, but I
found a few cases where the order isn't so easy to set in our own
CMakeLists.txt and still incorrectly uses -isystem where it shouldn't.
Also found using the BEFORE / AFTER arguments to include_directories(
doesn't make any difference to the use of -isystem.

Is this a known problem or is there a way to get this working?

-- 
- Campbell
___
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] Invoking CMakle outside of the build/source dir.

2011-06-06 Thread Campbell Barton
Hi, A handful of times I would have found it useful to run cmake
without having to be in the build dir, mostly there is some way to
change the CWD or write a shell wrapper, nevertheless it could still
be useful when launching builds from scripts or more limited
environments.

Is there some way to do this?:
cmake /some/source/dir /some/build/dir

... rather than
cd /some/source/dir ; cmake /some/build/dir
-- 
- Campbell
___
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] using "INSTALL(CODE ..." for multiple configurations.

2011-05-30 Thread Campbell Barton
On Mon, May 30, 2011 at 1:55 AM, Michael Hertling  wrote:
> On 05/30/2011 02:58 AM, Campbell Barton wrote:
>> Checking if this is possible since its quite verbose to have the same
>> command 4 times, one for each configuration.
>>
>> For blender3d on windows we need to extract python into the install
>> dir since we bundle it.
>>
>> This command looks like this:
>> --- snip
>>
>> install(
>>       CODE
>>       "
>>       execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir
>> \"${TARGETDIR_VER}/python/lib\"
>>               \"${CMAKE_COMMAND}\" -E tar xzfv 
>> \"${LIBDIR}/release/python32.tar.gz\")
>>       "
>>       CONFIGURATIONS Release
>> )
>>
>> --- snip
>>
>> The annoyance is that the same command needs to be called 3 times,
>> Release/RelWithDebInfo/MinSizeRel
>> Is there some way to list multiple 'CONFIGURATIONS' ?
>
> CMake's documentation states about INSTALL()'s CONFIGURATIONS
> argument: "The CONFIGURATIONS argument specifies a *list* of
> build configurations for which the install rule applies
> (Debug, Release, etc.)."
>
>> Ideally in this case Id like to have any 'Debug' extract
>> python32_d.tar.gz and any other configuration extract python32.tar.gz,
>> but a ways to have multiple configurations do one command would at
>> least be less verbose.
>
> Are you sure that the CONFIGURATIONS clause is available for the
> INSTALL(CODE ...) command? It's not specified, and on *nix, the
> following CMakeLists.txt issues the message upon "make install"
> regardless of the CMAKE_BUILD_TYPE variable's value whereas the
> INSTALL(FILES ...) command is sensitive as expected:
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
> PROJECT(INSTCONF NONE)
> SET(CMAKE_VERBOSE_MAKEFILE ON)
> INSTALL(CODE "MESSAGE(\"Installing\")" CONFIGURATIONS Release)
> INSTALL(FILES ${CMAKE_SOURCE_DIR}/CMakeLists.txt
>        DESTINATION ${CMAKE_BINARY_DIR}/cmake
>        CONFIGURATIONS Release)
>
> Does it work differently on Windows?
>
> Regards,
>
> Michael

Looked into this further, First, multiple configurations can be passed
separated by either spaces or ;.

So this works as expected:
---
install(
FILES ${LIBDIR}/python/lib/python32.dll
DESTINATION ${TARGETDIR}
CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
)
---

You're right, the install(CODE ... doesn't support configurations, in
fact our install target on windows was extracting python 4 times!

Instead I added a check in the CODE
---
install(
CODE
"
if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" STREQUAL \"Debug\")
execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir
\"${TARGETDIR_VER}/python/lib\"
\"${CMAKE_COMMAND}\" -E tar xzfv 
\"${LIBDIR}/release/python32_d.tar.gz\")
else()
execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir
\"${TARGETDIR_VER}/python/lib\"
\"${CMAKE_COMMAND}\" -E tar xzfv 
\"${LIBDIR}/release/python32.tar.gz\")
endif()
"
)
---

Since CONFIGURATIONS is listed as an option I assumed it would work
with all install uses of install.
It would be good if the cmake docs mentioned which commands support
CONFIGURATIONS (FILES/DIRECTORY only?), I re-read and couldn't find
anything relating to this.

- Campbell
___
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] using "INSTALL(CODE ..." for multiple configurations.

2011-05-29 Thread Campbell Barton
Checking if this is possible since its quite verbose to have the same
command 4 times, one for each configuration.

For blender3d on windows we need to extract python into the install
dir since we bundle it.

This command looks like this:
--- snip

install(
CODE
"
execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir
\"${TARGETDIR_VER}/python/lib\"
\"${CMAKE_COMMAND}\" -E tar xzfv 
\"${LIBDIR}/release/python32.tar.gz\")
"
CONFIGURATIONS Release
)

--- snip

The annoyance is that the same command needs to be called 3 times,
Release/RelWithDebInfo/MinSizeRel
Is there some way to list multiple 'CONFIGURATIONS' ?

Ideally in this case Id like to have any 'Debug' extract
python32_d.tar.gz and any other configuration extract python32.tar.gz,
but a ways to have multiple configurations do one command would at
least be less verbose.

-- 
- Campbell
___
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] How to define datafiles?

2011-04-24 Thread Campbell Barton
2011/4/23 YangXi :
> In my program, I have several pictures and plain-text data files. Usually in
> a unix system, they should be placed on /usr/share/my_program/some_place.
> How could I define those files in CMakeLists, and make their location known
> by the program?
> Thanks!

first define the prefix in CMake so you can use it in your C program.
add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")

the C program can then add the rest of the path "share/my_program/some_place"

You'll also want to install this file so its copied on "make install"


-- 
- Campbell
___
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] Alternative default CMAKE_C_STANDARD_LIBRARIES_INIT

2011-04-10 Thread Campbell Barton
Yesterday I found there was a bug caused by the default linking flags
(-ladvapi32 with mingw incidentally was crashing with "%.*f" printf()
formatting).

So I tried to override CMAKE_C_STANDARD_LIBRARIES &
CMAKE_C_STANDARD_LIBRARIES_INIT but wasn't able to find any nice way
of doing it.
the problem is that project(...) sets both
CMAKE_C_STANDARD_LIBRARIES_INIT and CMAKE_C_STANDARD_LIBRARIES so
there is nowhere you can add in your own overrides/replacements.

This issue is that I want to make it as if
CMAKE_C_STANDARD_LIBRARIES_INIT didnt include -ladvapi32, but
otherwise works the same as it does now.
its easy to clobber CMAKE_C_STANDARD_LIBRARIES on every run but then
the cached value isnt any use (since the dev building may want to
set).

So the solution I found is to check if the value is defined, if not,
override it after the project(...) is defined, saving the cache.
this works but I was wondering if there was a better way.

# -- snip
if(DEFINED CMAKE_C_STANDARD_LIBRARIES)
set(_reset_standard_libraries OFF)
else()
set(_reset_standard_libraries ON)
endif()

project(MyProject)


if (_reset_standard_libraries)
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES)
mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES)
endif()
unset(_reset_standard_libraries)
# --
-- 
- Campbell
___
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] QtCreator project generator

2011-03-09 Thread Campbell Barton
On Mon, Mar 7, 2011 at 8:46 PM, Alexander Neundorf
 wrote:
> On Friday 04 March 2011, Campbell Barton wrote:
>> On Thu, Mar 3, 2011 at 5:10 PM, Alexander Neundorf
>>
>>  wrote:
>> > On Tuesday 01 March 2011, Campbell Barton wrote:
>> >> On Tue, Mar 1, 2011 at 2:47 PM, Marcus D. Hanwell
>> >>
>> >>  wrote:
>> >> > On Tue, Mar 1, 2011 at 9:15 AM, John Drescher 
>> >
>> > wrote:
>> >> >> On Tue, Mar 1, 2011 at 6:45 AM, Campbell Barton
>> >> >> 
>> >
>> > wrote:
>> >> >>> QT-Creator which currently supports CMake by reading code::blocks
>> >> >>> project files.
>> >> >>>
>> >> >>> The problem with this is code::blocks project files don't write in
>> >> >>> #defines, so the IDE shows #ifdef's incorrecyly.
>> >
>> > What are they needed for ?
>> > Does CodeBlocks and/or QtCreator do syntax highlighting based on this
>> > information ?
>> >
>> > http://wiki.codeblocks.org/index.php?title=Project_file
>> >
>> > The QtCreator developer is open to suggestions how to improve the CMake
>> > integration.
>> > So, adding stuff to the CodeBlocks project should be ok.
>> > Is there already a tag like that for C::B project files ? I can not
>> > really find one.
>> >
>> > Alex
>>
>> Yep, QtCreator will act as code is commented if the define are not
>> found, you can type of course but no auto-complete or syntax
>> highlighting.
>> I don't use code::blocks but suspect it doesn't work this way.
>>
>> From my previous mail, heres a patch to cmake's codeblocks generator.
>> http://www.graphicall.org/ftp/ideasman42/code_blocks.diff
>>
>> If this was applied qtcreator could use the defines.
>
> So QtCreator parses the -D options and uses them ?
>
> If so, please add this to the cmake bug tracker as feature request.
>
> Alex

No, QtCreator doesn't use them, but it could if they were written.

So not sure this is a bug, but from the user level its frustrating not
to have defines come into QtCreator so for this to be supported I
think my patch would need to be applied.
___
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] QtCreator project generator

2011-03-03 Thread Campbell Barton
On Thu, Mar 3, 2011 at 5:10 PM, Alexander Neundorf
 wrote:
> On Tuesday 01 March 2011, Campbell Barton wrote:
>> On Tue, Mar 1, 2011 at 2:47 PM, Marcus D. Hanwell
>>
>>  wrote:
>> > On Tue, Mar 1, 2011 at 9:15 AM, John Drescher 
> wrote:
>> >> On Tue, Mar 1, 2011 at 6:45 AM, Campbell Barton 
> wrote:
>> >>> QT-Creator which currently supports CMake by reading code::blocks
>> >>> project files.
>> >>>
>> >>> The problem with this is code::blocks project files don't write in
>> >>> #defines, so the IDE shows #ifdef's incorrecyly.
>
> What are they needed for ?
> Does CodeBlocks and/or QtCreator do syntax highlighting based on this
> information ?
>
> http://wiki.codeblocks.org/index.php?title=Project_file
>
> The QtCreator developer is open to suggestions how to improve the CMake
> integration.
> So, adding stuff to the CodeBlocks project should be ok.
> Is there already a tag like that for C::B project files ? I can not really
> find one.
>
> Alex

Yep, QtCreator will act as code is commented if the define are not
found, you can type of course but no auto-complete or syntax
highlighting.
I don't use code::blocks but suspect it doesn't work this way.

>From my previous mail, heres a patch to cmake's codeblocks generator.
http://www.graphicall.org/ftp/ideasman42/code_blocks.diff

If this was applied qtcreator could use the defines.

-- 
- Campbell
___
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] QtCreator project generator

2011-03-03 Thread Campbell Barton
On Tue, Mar 1, 2011 at 3:45 PM, Campbell Barton  wrote:
> On Tue, Mar 1, 2011 at 2:47 PM, Marcus D. Hanwell
>  wrote:
>> On Tue, Mar 1, 2011 at 9:15 AM, John Drescher  wrote:
>>> On Tue, Mar 1, 2011 at 6:45 AM, Campbell Barton  
>>> wrote:
>>>> QT-Creator which currently supports CMake by reading code::blocks project 
>>>> files.
>>>>
>>>> The problem with this is code::blocks project files don't write in
>>>> #defines, so the IDE shows #ifdef's incorrecyly.
>>>>
>>>> For the short term I wrote a eclipse -> qtcreator project converter in
>>>> python, which has a few hard coded values but could easily be made
>>>> generic.
>>>> http://www.pasteall.org/19595/python
>>>>
>>>> So I was wondering if CMake developers would accept a patch to add
>>>> native generation of qtcreator project files?
>>>>
>>>> An alternative solutions could be to write defines into code::blocks
>>>> files, or for qtcreator to read in eclipse files instead but qtcreator
>>>> project files are quite simple to write so if this feature is
>>>> acceptable I was thinking to try and write a patch.
>>>
>>> Recent versions of QtCreator use CMakeLists.txt directly? Is there
>>> something missing in this functionality?
>>>
>> You can open a CMakeLists.txt as a project, this then uses the CMake
>> plugin to create a build directory, use the CodeBlocks - Unix
>> Makefiles generator and then add a CMakeLists.txt.user with some
>> project settings. As stated, it lacks the #defines, although this is
>> less pronounced in many of the projects I work on where configured
>> headers are used.
>>
>> I am not a core CMake developer, but it seems to me that extending the
>> CodeBlocks generator would be the right thing to do here (if that is
>> feasible). I think Alexander Neundorf did a lot of this work,
>> hopefully he will comment.
>>
>> Marcus
>
> Looked into this further and there is really no problem with
> code::blocks generator,
> The way it works is it calls make directly, so there is no need for
> the code::blocks file to contain defines.
> http://www.graphicall.org/ftp/ideasman42/code_blocks.diff
>
> All things considered I still think a QtCreator project generator is
> the way to go.

Hi, my original questions is still unanswered.
I'm not familiar with how the CMake project goes about these decisions.

Are there any developers on this list who might review patches for new
project generators?
If so, any idea if this would be acceptable functionality to add?
___
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] QtCreator project generator

2011-03-01 Thread Campbell Barton
On Tue, Mar 1, 2011 at 2:47 PM, Marcus D. Hanwell
 wrote:
> On Tue, Mar 1, 2011 at 9:15 AM, John Drescher  wrote:
>> On Tue, Mar 1, 2011 at 6:45 AM, Campbell Barton  wrote:
>>> QT-Creator which currently supports CMake by reading code::blocks project 
>>> files.
>>>
>>> The problem with this is code::blocks project files don't write in
>>> #defines, so the IDE shows #ifdef's incorrecyly.
>>>
>>> For the short term I wrote a eclipse -> qtcreator project converter in
>>> python, which has a few hard coded values but could easily be made
>>> generic.
>>> http://www.pasteall.org/19595/python
>>>
>>> So I was wondering if CMake developers would accept a patch to add
>>> native generation of qtcreator project files?
>>>
>>> An alternative solutions could be to write defines into code::blocks
>>> files, or for qtcreator to read in eclipse files instead but qtcreator
>>> project files are quite simple to write so if this feature is
>>> acceptable I was thinking to try and write a patch.
>>
>> Recent versions of QtCreator use CMakeLists.txt directly? Is there
>> something missing in this functionality?
>>
> You can open a CMakeLists.txt as a project, this then uses the CMake
> plugin to create a build directory, use the CodeBlocks - Unix
> Makefiles generator and then add a CMakeLists.txt.user with some
> project settings. As stated, it lacks the #defines, although this is
> less pronounced in many of the projects I work on where configured
> headers are used.
>
> I am not a core CMake developer, but it seems to me that extending the
> CodeBlocks generator would be the right thing to do here (if that is
> feasible). I think Alexander Neundorf did a lot of this work,
> hopefully he will comment.
>
> Marcus

Looked into this further and there is really no problem with
code::blocks generator,
The way it works is it calls make directly, so there is no need for
the code::blocks file to contain defines.
http://www.graphicall.org/ftp/ideasman42/code_blocks.diff

All things considered I still think a QtCreator project generator is
the way to go.

-- 
- Campbell
___
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] QtCreator project generator

2011-03-01 Thread Campbell Barton
QT-Creator which currently supports CMake by reading code::blocks project files.

The problem with this is code::blocks project files don't write in
#defines, so the IDE shows #ifdef's incorrecyly.

For the short term I wrote a eclipse -> qtcreator project converter in
python, which has a few hard coded values but could easily be made
generic.
http://www.pasteall.org/19595/python

So I was wondering if CMake developers would accept a patch to add
native generation of qtcreator project files?

An alternative solutions could be to write defines into code::blocks
files, or for qtcreator to read in eclipse files instead but qtcreator
project files are quite simple to write so if this feature is
acceptable I was thinking to try and write a patch.

-- 
- Campbell
___
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] Automatic out of source build's possible?

2011-02-07 Thread Campbell Barton
For blender we currently support 2 build systems - SCons and CMake,
Quite a few technical users build from source on *nix just to get the
latest version and use scons, I suspect this is because scons
configures every time and its simple just to type "scons" in the
source dir and end up with a build.
We have SCons configured to do an out-of-source build by default with
a predefined directory.

I wasn't aware of anything similar for CMake so I write a GNUmakefile
(included below) in the root source dir to do something similar for
CMake.
(note, we don't allow in-source builds at the moment so there is no
conflict with possible in-source makefiles).

This makefile creates a per-defined out-of-source build dir if
necessary and runs make, since we explicitly list source files and
headers in the CMakeLists.txt cmake will re-configure if needed.

So my questions are...
- Do other projects do this? is there some preferred way to do this?
- Is it possible to setup the CMakeLists.txt so the generated
makefiles are written to a directory other then the CWD?
- Is there any way to default to our-of-source build when running
"cmake ." in the source dir? (rather then aborting which is what we do
now).

Probably our users should just get the hang on setting up out of
source builds but I think they like the convenience.

# 
# This Makefile does an out-of-source CMake build in ../build/`OS`_`CPU`
# eg:
#   ../build/Linux_i386
# This is for users who like to configure & build blender with a single command.

# System Vars
OS:=$(shell uname -s)
OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]')

# Source and Build DIR's
BLENDER_DIR:=$(shell pwd -P)
BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)

# Get the number of cores for threaded build
NPROCS:=1
ifeq ($(OS), Linux)
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
endif
ifeq ($(OS), Darwin)
NPROCS:=$(shell system_profiler | awk '/Number Of CPUs/{print $4}{next;}')
endif
ifeq ($(OS), FreeBSD)
NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
endif
ifeq ($(OS), NetBSD)
NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
endif


# Build Blender
all:
@echo
@echo Configuring Blender ...

if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
mkdir -p $(BUILD_DIR) ; \
cd $(BUILD_DIR) ; \
cmake $(BLENDER_DIR) -DCMAKE_BUILD_TYPE:STRING=Release ; \
fi

@echo
@echo Building Blender ...
cd $(BUILD_DIR) ; make -s -j $(NPROCS)
@echo
@echo run blender from "$(BUILD_DIR)/bin/blender"
@echo

.PHONY: all

# 

- Campbell
___
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] Possible 'brief' output options for UnixMakefileGenerator

2010-12-21 Thread Campbell Barton
The problem with with RULE_MESSAGES is that it is too close to "make >
/dev/null".
If a file is built there is no info about this.

The main issue for me is partial rebuilds flood the console.

eg, for blender, a build with no changes prints 83 lines like this...
[  1%] Built target bf_editor_animation
[  2%] Built target bf_editor_armature
[  2%] Built target bf_editor_curve
[  5%] Built target bf_editor_datafiles
...

If one file changes, it prints 87 lines.

So perhaps this could be solved by having "Built target" messages
print, only if one of the C/C++ files was rebuilt, or lib linked.

Would this be acceptable? (as default or an option)

On Tue, Dec 21, 2010 at 12:13 PM, David Cole  wrote:
> One more alternative worth considering here that is cross-platform and
> doesn't require a wrapper script. (Not sure if it quiets things down enough
> for you or not, but the latest change to this feature will quiet things a
> little bit more starting with the upcoming CMake 2.8.4.)
>
> See the RULE_MESSAGES global property:
> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_global:RULE_MESSAGES
>
> And bugs related to it (all of which are closed at this point):
> http://public.kitware.com/Bug/view.php?id=5323
> http://public.kitware.com/Bug/view.php?id=7062
> http://public.kitware.com/Bug/view.php?id=8726
> http://public.kitware.com/Bug/view.php?id=11304
>
>
> HTH,
> David
>
>
> On Mon, Dec 20, 2010 at 11:59 PM, Campbell Barton 
> wrote:
>>
>> Slightly improved version which treats "Linking" lines separately from
>> source lines.
>> and its not messed up by threaded builds.
>>
>> ---
>> #!/bin/bash
>> # filters CMake output to be more like nan-makefiles
>>
>> FILTER="^\[ *[0-9]*%] \|^Built target "
>> make $@ | \
>>                sed -u -e 's/^Linking .*\//Linking /' | \
>>                sed -u -e 's/^.*\//  /' | \
>>                grep --line-buffered -v "$FILTER"
>>
>> echo "Build Done"
>> ---
>>
>> Output looks like this...
>>
>> Linking libbf_intern_audaspace.a
>>  sp_ienv.c.o
>>  binreloc.c.o
>>  sp_preorder.c.o
>>  spanel_bmod.c.o
>>  glew.c.o
>>  MT_ExpMap.cpp.o
>> Linking libextern_binreloc.a
>>  spanel_dfs.c.o
>>  spivotL.c.o
>> Linking libge_videotex.a
>>
>>
>>
>> On Tue, Dec 21, 2010 at 3:04 AM, j s  wrote:
>> > Cool,
>> >
>> > You might want to put a '^' after each \|, if that is how grep regex
>> > handles
>> > it.  I've tended toward egrep which is more perl like when doing more
>> > complicated expressions.  Color is probably lost since it is no longer a
>> > tty.
>> >
>> > Juan
>> >
>> > On Mon, Dec 20, 2010 at 3:56 PM, Campbell Barton 
>> > wrote:
>> >>
>> >> @Michael Wild. good point about threaded builds, so I take back the
>> >> bit about "Entering directory, then filenames only", nevertheless.
>> >> some way to reduce flooding the console when rebuilding a single file
>> >> would be much appreciated.
>> >>
>> >> @Juan, from your suggestion, I now use this.
>> >>
>> >> ---
>> >> #!/bin/bash
>> >> # filters CMake output to be more like nan-makefiles
>> >>
>> >> FILTER="^Scanning \|Linking \(C\|CXX\) static library \|Built target "
>> >> make $@ | grep --line-buffered -v "$FILTER" | sed  -e 's/^.*\//  /'
>> >> echo "Build Done"
>> >> ---
>> >>
>> >> Jesper Eskilson, agree supporting make -s would be good to have.
>> >>
>> >> On Mon, Dec 20, 2010 at 10:05 AM, Jesper Eskilson
>> >>  wrote:
>> >> > On 12/20/2010 01:01 AM, Campbell Barton wrote:
>> >> >>
>> >> >> Hi, I'm STILL trying to have CMake makefiles replace Blender's hand
>> >> >> crafted makefiles.
>> >> >>
>> >> >> Now the main sticking point with 2 other developers is they don't
>> >> >> like
>> >> >> CMakes output, as its overly verbose.
>> >> >>
>> >> >> I realize CMake doesn't need to bend to the whim of all users but
>> >> >> wondering if we could have something like  RULE_BRIEF_OUTPUT
>> >> >>
>> >> >> Rather then printing progress and fu

Re: [CMake] Possible 'brief' output options for UnixMakefileGenerator

2010-12-20 Thread Campbell Barton
Slightly improved version which treats "Linking" lines separately from
source lines.
and its not messed up by threaded builds.

---
#!/bin/bash
# filters CMake output to be more like nan-makefiles

FILTER="^\[ *[0-9]*%] \|^Built target "
make $@ | \
sed -u -e 's/^Linking .*\//Linking /' | \
sed -u -e 's/^.*\//  /' | \
grep --line-buffered -v "$FILTER"

echo "Build Done"
---

Output looks like this...

Linking libbf_intern_audaspace.a
  sp_ienv.c.o
  binreloc.c.o
  sp_preorder.c.o
  spanel_bmod.c.o
  glew.c.o
  MT_ExpMap.cpp.o
Linking libextern_binreloc.a
  spanel_dfs.c.o
  spivotL.c.o
Linking libge_videotex.a



On Tue, Dec 21, 2010 at 3:04 AM, j s  wrote:
> Cool,
>
> You might want to put a '^' after each \|, if that is how grep regex handles
> it.  I've tended toward egrep which is more perl like when doing more
> complicated expressions.  Color is probably lost since it is no longer a
> tty.
>
> Juan
>
> On Mon, Dec 20, 2010 at 3:56 PM, Campbell Barton 
> wrote:
>>
>> @Michael Wild. good point about threaded builds, so I take back the
>> bit about "Entering directory, then filenames only", nevertheless.
>> some way to reduce flooding the console when rebuilding a single file
>> would be much appreciated.
>>
>> @Juan, from your suggestion, I now use this.
>>
>> ---
>> #!/bin/bash
>> # filters CMake output to be more like nan-makefiles
>>
>> FILTER="^Scanning \|Linking \(C\|CXX\) static library \|Built target "
>> make $@ | grep --line-buffered -v "$FILTER" | sed  -e 's/^.*\//  /'
>> echo "Build Done"
>> ---
>>
>> Jesper Eskilson, agree supporting make -s would be good to have.
>>
>> On Mon, Dec 20, 2010 at 10:05 AM, Jesper Eskilson
>>  wrote:
>> > On 12/20/2010 01:01 AM, Campbell Barton wrote:
>> >>
>> >> Hi, I'm STILL trying to have CMake makefiles replace Blender's hand
>> >> crafted makefiles.
>> >>
>> >> Now the main sticking point with 2 other developers is they don't like
>> >> CMakes output, as its overly verbose.
>> >>
>> >> I realize CMake doesn't need to bend to the whim of all users but
>> >> wondering if we could have something like  RULE_BRIEF_OUTPUT
>> >>
>> >> Rather then printing progress and full path for all files it could
>> >> skip percentage and use a relative path for each C file.
>> >>
>> >> I can try submitting a patch but would first like to know if this
>> >> would be acceptable.
>> >
>> > I've submitted a bugreport about this:
>> > http://www.cmake.org/Bug/view.php?id=7062. It was submitted almost two
>> > years
>> > ago, so I'm not sure it is getting very much attention by the CMake
>> > people.
>> >
>> > --
>> > Jesper Eskilson
>> > Developer
>> > IAR Systems
>> >
>> > ___
>> > 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
>> >
>>
>>
>>
>> --
>> - Campbell
>> ___
>> 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
>
>



-- 
- Campbell
___
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] Possible 'brief' output options for UnixMakefileGenerator

2010-12-20 Thread Campbell Barton
@Michael Wild. good point about threaded builds, so I take back the
bit about "Entering directory, then filenames only", nevertheless.
some way to reduce flooding the console when rebuilding a single file
would be much appreciated.

@Juan, from your suggestion, I now use this.

---
#!/bin/bash
# filters CMake output to be more like nan-makefiles

FILTER="^Scanning \|Linking \(C\|CXX\) static library \|Built target "
make $@ | grep --line-buffered -v "$FILTER" | sed  -e 's/^.*\//  /'
echo "Build Done"
---

Jesper Eskilson, agree supporting make -s would be good to have.

On Mon, Dec 20, 2010 at 10:05 AM, Jesper Eskilson
 wrote:
> On 12/20/2010 01:01 AM, Campbell Barton wrote:
>>
>> Hi, I'm STILL trying to have CMake makefiles replace Blender's hand
>> crafted makefiles.
>>
>> Now the main sticking point with 2 other developers is they don't like
>> CMakes output, as its overly verbose.
>>
>> I realize CMake doesn't need to bend to the whim of all users but
>> wondering if we could have something like  RULE_BRIEF_OUTPUT
>>
>> Rather then printing progress and full path for all files it could
>> skip percentage and use a relative path for each C file.
>>
>> I can try submitting a patch but would first like to know if this
>> would be acceptable.
>
> I've submitted a bugreport about this:
> http://www.cmake.org/Bug/view.php?id=7062. It was submitted almost two years
> ago, so I'm not sure it is getting very much attention by the CMake people.
>
> --
> Jesper Eskilson
> Developer
> IAR Systems
>
> ___
> 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
>



-- 
- Campbell
___
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] Possible 'brief' output options for UnixMakefileGenerator

2010-12-19 Thread Campbell Barton
Hi, I'm STILL trying to have CMake makefiles replace Blender's hand
crafted makefiles.

Now the main sticking point with 2 other developers is they don't like
CMakes output, as its overly verbose.

I realize CMake doesn't need to bend to the whim of all users but
wondering if we could have something like  RULE_BRIEF_OUTPUT

Rather then printing progress and full path for all files it could
skip percentage and use a relative path for each C file.

I can try submitting a patch but would first like to know if this
would be acceptable.

how it looks now...
--- snip
Scanning dependencies of target bf_editor_animation
[  0%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/anim_channels_defines.c.o
[  0%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/anim_channels_edit.c.o
[  0%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/anim_deps.c.o
[  0%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/anim_filter.c.o
[  0%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/anim_ipo_utils.c.o
[  0%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/anim_markers.c.o
[  0%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/drivers.c.o
[  0%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/fmodifier_ui.c.o
[  1%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/keyframes_draw.c.o
[  1%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/keyframes_edit.c.o
[  1%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/keyframes_general.c.o
[  1%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/keyframing.c.o
[  1%] Building C object
source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/keyingsets.c.o
Linking C static library ../../../../lib/libbf_editor_animation.a
[  1%] Built target bf_editor_animation
Scanning dependencies of target bf_editor_armature
[  1%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/armature_ops.c.o
[  1%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/editarmature.c.o
[  1%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/editarmature_generate.c.o
[  1%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/editarmature_retarget.c.o
[  1%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/editarmature_sketch.c.o
[  1%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/poseSlide.c.o
[  2%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/poseUtils.c.o
[  2%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/poselib.c.o
[  2%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/poseobject.c.o
[  2%] Building C object
source/blender/editors/armature/CMakeFiles/bf_editor_armature.dir/reeb.c.o
Linking C static library ../../../../lib/libbf_editor_armature.a
[  2%] Built target bf_editor_armature
Scanning dependencies of target bf_editor_curve
[  2%] Building C object
source/blender/editors/curve/CMakeFiles/bf_editor_curve.dir/curve_ops.c.o
[  2%] Building C object
source/blender/editors/curve/CMakeFiles/bf_editor_curve.dir/editcurve.c.o
[  2%] Building C object
source/blender/editors/curve/CMakeFiles/bf_editor_curve.dir/editfont.c.o
Linking C static library ../../../../lib/libbf_editor_curve.a
[  2%] Built target bf_editor_curve
[  5%] Built target bf_editor_datafiles
---

What it could look like...
--- snip
Entering 'source/blender/editors/animation'
 anim_channels_defines.c
 anim_channels_edit.c
 anim_deps.c
 anim_filter.c
 anim_ipo_utils.c
 anim_markers.c
 drivers.c
 fmodifier_ui.c
 keyframes_draw.c
 keyframes_edit.c
 keyframes_general.c
 keyframing.c
 keyingsets.c
Linking C static library ../../../../lib/libbf_editor_animation.a
[  1%] Built target bf_editor_animation
Entering 'source/blender/editors/armature'
 armature_ops.c
 editarmature.c
 editarmature_generate.c
 editarmature_retarget.c
 editarmature_sketch.c
 poseSlide.c
 poseUtils.c
 poselib.c
 poseobject.c
 reeb.c
Linking C static library ../../../../lib/libbf_editor_armature.a
[  2%] Built target bf_editor_armature
Entering 'source/blender/editors/curve'
 curve_ops.c
 editcurve.c
 editfont.c
Linking C static library ../../../../lib/libbf_editor_curve.a
[  2%] Built target bf_editor_curve
[  5%] Built target bf_editor_datafiles
---

-- 
- Campbell
___
Powered by www.kitware.com

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

[CMake] Macro for adding cflags, odd quirk with CHECK_C_COMPILER_FLAG

2010-12-16 Thread Campbell Barton
Hi, we were having some problems with warnings and gcc versions so I
thought to write a macro that adds a flag to any string (typically
CMAKE_C_FLAGS)

ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS -Wno-unknown-pragmas)

...this is the macro.

macro(ADD_CHECK_C_COMPILER_FLAG
_CFLAGS
_FLAG)

include(CheckCCompilerFlag)

# odd workaround
set(CFLAG_TEST "CFLAG_TEST")
CHECK_C_COMPILER_FLAG("${_FLAG}" CFLAG_TEST)
if(CFLAG_TEST)
# message(STATUS "Using CFLAG: ${_FLAG}")
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}")
else()
message(STATUS "Unsupported CFLAG: ${_FLAG}")
endif()
endmacro()


My question is why this is needed?
set(CFLAG_TEST "CFLAG_TEST")
CHECK_C_COMPILER_FLAG("${_FLAG}" CFLAG_TEST)

If I do this (as I see in other examples online)...
CHECK_C_COMPILER_FLAG("${_FLAG}" CFLAG_TEST)

This if check fails in CheckCSourceCompiles.cmake:28 ...

MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
  IF("${VAR}" MATCHES "^${VAR}$")

This is confusing since from what I can tell CFLAG_TEST can be an
undefined variable.
Any idea whats going on?, CMake 2.8.3

-- 
- Campbell
___
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.3-rc4 ready for testing!

2010-10-31 Thread Campbell Barton
Hi I saw in the log you added a case for Python 2.7,
Would you be able to add a check for Python 3.x ?

For Blender 3D we use CMake and only support python 3.x series.
___
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] Status of clang support?

2010-10-27 Thread Campbell Barton
On Tue, Oct 26, 2010 at 1:02 AM, Mateusz Loskot  wrote:
> On 25/10/10 01:38, Mateusz Loskot wrote:
>> On 24/10/10 23:00, Ryan Pavlik wrote:
>>> My best guess would be to check for some Clang-specific defines,
>>> similar to the platform checks.  Actually, it looks like in the Git
>>> repository of CMake, there is now some Clang-specific support:
>>> http://github.com/Kitware/CMake/commit/571dc7489111893355deba710feee5990bce92e4
>>> I think that this commit is included in 2.8.2.
>>
>> Ryan,
>>
>> It's very good to know.
>>
>>> I've made a note on that commit as to where I think a Clang-specific
>>> variable might be set.
>>
>> I've seen, great!
>>
>>> For now, you might be able to look at the
>>> value of CMAKE_CXX_COMPILER_ID for a more general solution - it seems
>>> like that might contain "Clang" if building using Clang.
>>
>> I'm having access to CMake 2.8.0 at this moment
>> And, this version sets CMAKE_CXX_COMPILER_ID to GNU, even if
>> C/C++ compilers set to clang:
>>
>> cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
>>
>> Also, simple test always reports the "gnu".
>>
>> if("${CMAKE_CXX_COMPILER_ID}" MATCHES "clang")
>>   message(STATUS "clang")
>> elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
>>   message(STATUS "gnu")
>> endif()
>>
>> I will try 2.8.2 soon.
>>
>> Thanks for your help!
>
> FYI,
>
> I have tried clang 2.9 (current SVN trunk)
> together with CMake from current git.
>
> The compiler ID matching works perfectly well!
>
> Thanks again!
>
> Best regards,

I've been using Clang static analyzer & regular Clang from SVN with
CMake  for some time and I only have 2 problems with this.
* When switching compilers some settings are lost, this is an
annoyance when using ccmake, since I have custom includes that need to
be entered in manually.
* For some reason I need to manually add these include paths to my
CXXFLAGS -I/usr/include/c++/4.5.1
-I/usr/include/c++/4.5.1/x86_64-unknown-linux-gnu/

Otherwise this works really well and gives especially good warnings &
errors with macros, aside from the static checker.
-- 
- Campbell
___
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] Less Noisy Makefiles?

2010-10-09 Thread Campbell Barton
On Fri, Oct 8, 2010 at 5:16 AM, Campbell Barton  wrote:
> On Thu, Oct 7, 2010 at 9:55 PM, David Cole  wrote:
>> On Thu, Oct 7, 2010 at 5:34 PM, Campbell Barton 
>> wrote:
>>>
>>> On Thu, Oct 7, 2010 at 8:48 PM, Campbell Barton 
>>> wrote:
>>> > On Thu, Oct 7, 2010 at 10:44 AM, Michael Wild  wrote:
>>> >>
>>> >> On 7. Oct, 2010, at 11:58 , Campbell Barton wrote:
>>> >>
>>> >>> Hi, I was wondering if this is possible or if it would be acceptable
>>> >>> to disable progress printout.
>>> >>>
>>> >>> At the moment building with only minor changes prints a lot of text
>>> >>> with CMake & Makefiles.
>>> >>>
>>> >>> eg:
>>> >>> [  4%] Built target bf_intern_audaspace
>>> >>> [  4%] Built target bf_intern_string
>>> >>> [  6%] Built target bf_intern_ghost
>>> >>>
>>> >>> full log.
>>> >>> http://www.pasteall.org/16053
>>> >>>
>>> >>> Setting: SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES OFF)
>>> >>> is no good because I want to see the lines which are running/building,
>>> >>> just not the progress lines that do nothing (the reverse really).
>>> >>>
>>> >>> I found some messages about this but they only refer to RULE_MESSAGES.
>>> >>>
>>> >>> This may seem silly but its actually one of the reasons we still have
>>> >>> hand written makefiles in our project (which Im trying to get replaced
>>> >>> with cmake).
>>> >>>
>>> >>> Would this be acceptable?
>>> >>>
>>> >>
>>> >> what happens if you run "make VERBOSE=1" or enable
>>> >> CMAKE_VERBOSE_MAKEFILE?
>>> >>
>>> >> Michael
>>> >>
>>> >> --
>>> >> There is always a well-known solution to every human problem -- neat,
>>> >> plausible, and wrong.
>>> >> H. L. Mencken
>>> >
>>> > using verbose makefiles it gives a lot of output even when running a
>>> > build with no changes to any C files.
>>> > http://www.pasteall.org/16061
>>> >
>>> > Im pretty happy with cmake's current output, its just for doing
>>> > rebuilds during development where only a few files change, the
>>> > progress gets in the way of seeing output of the files which do
>>> > rebuild.
>>> >
>>> > So I think it would be good to have a RULE_PROGRESS option, since I
>>> > still want to see RULE_MESSAGES.
>>>
>>> Im using CMake from GIT, and IIRC RULE_MESSAGES used to disable
>>> progress, this link confirms.
>>> http://www.itk.org/Bug/bug_view_advanced_page.php?bug_id=8726
>>>
>>> but at the moment % progress is enabled whatever its set to.
>>>
>>> --
>>> - Campbell
>>> ___
>>> 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
>>
>> According to the last note in bug #8726, you should run cmake with:
>> -DCMAKE_RULE_MESSAGES=OFF
>> to turn these things off.
>> Have you done that? Or have you only tried the RULE_MESSAGES global
>> property?
>> I have not looked at the code, but the bug says something different than
>> what your email says. -D variables and global properties are 2 different
>> things...
>> If you use -D to set CMAKE_RULE_MESSAGES to OFF does it actually turn them
>> off?
>>
>
> I tried both in latest GIT's cmake, nether turn the progress off
> also looked into the code and from what I can tell there are no checks
> supress progress.
>
> --
> - Campbell
>

Looked into the source and found the reason progress is still being
printed when RULE_MESSAGES is off.
Reported: http://www.cmake.org/Bug/view.php?id=11304

was looking into a progress patch but best this gets resolved first.
-- 
- Campbell
___
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] Less Noisy Makefiles?

2010-10-07 Thread Campbell Barton
On Thu, Oct 7, 2010 at 9:55 PM, David Cole  wrote:
> On Thu, Oct 7, 2010 at 5:34 PM, Campbell Barton 
> wrote:
>>
>> On Thu, Oct 7, 2010 at 8:48 PM, Campbell Barton 
>> wrote:
>> > On Thu, Oct 7, 2010 at 10:44 AM, Michael Wild  wrote:
>> >>
>> >> On 7. Oct, 2010, at 11:58 , Campbell Barton wrote:
>> >>
>> >>> Hi, I was wondering if this is possible or if it would be acceptable
>> >>> to disable progress printout.
>> >>>
>> >>> At the moment building with only minor changes prints a lot of text
>> >>> with CMake & Makefiles.
>> >>>
>> >>> eg:
>> >>> [  4%] Built target bf_intern_audaspace
>> >>> [  4%] Built target bf_intern_string
>> >>> [  6%] Built target bf_intern_ghost
>> >>>
>> >>> full log.
>> >>> http://www.pasteall.org/16053
>> >>>
>> >>> Setting: SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES OFF)
>> >>> is no good because I want to see the lines which are running/building,
>> >>> just not the progress lines that do nothing (the reverse really).
>> >>>
>> >>> I found some messages about this but they only refer to RULE_MESSAGES.
>> >>>
>> >>> This may seem silly but its actually one of the reasons we still have
>> >>> hand written makefiles in our project (which Im trying to get replaced
>> >>> with cmake).
>> >>>
>> >>> Would this be acceptable?
>> >>>
>> >>
>> >> what happens if you run "make VERBOSE=1" or enable
>> >> CMAKE_VERBOSE_MAKEFILE?
>> >>
>> >> Michael
>> >>
>> >> --
>> >> There is always a well-known solution to every human problem -- neat,
>> >> plausible, and wrong.
>> >> H. L. Mencken
>> >
>> > using verbose makefiles it gives a lot of output even when running a
>> > build with no changes to any C files.
>> > http://www.pasteall.org/16061
>> >
>> > Im pretty happy with cmake's current output, its just for doing
>> > rebuilds during development where only a few files change, the
>> > progress gets in the way of seeing output of the files which do
>> > rebuild.
>> >
>> > So I think it would be good to have a RULE_PROGRESS option, since I
>> > still want to see RULE_MESSAGES.
>>
>> Im using CMake from GIT, and IIRC RULE_MESSAGES used to disable
>> progress, this link confirms.
>> http://www.itk.org/Bug/bug_view_advanced_page.php?bug_id=8726
>>
>> but at the moment % progress is enabled whatever its set to.
>>
>> --
>> - Campbell
>> ___
>> 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
>
> According to the last note in bug #8726, you should run cmake with:
> -DCMAKE_RULE_MESSAGES=OFF
> to turn these things off.
> Have you done that? Or have you only tried the RULE_MESSAGES global
> property?
> I have not looked at the code, but the bug says something different than
> what your email says. -D variables and global properties are 2 different
> things...
> If you use -D to set CMAKE_RULE_MESSAGES to OFF does it actually turn them
> off?
>

I tried both in latest GIT's cmake, nether turn the progress off
also looked into the code and from what I can tell there are no checks
supress progress.

-- 
- Campbell
___
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] Less Noisy Makefiles?

2010-10-07 Thread Campbell Barton
On Thu, Oct 7, 2010 at 8:48 PM, Campbell Barton  wrote:
> On Thu, Oct 7, 2010 at 10:44 AM, Michael Wild  wrote:
>>
>> On 7. Oct, 2010, at 11:58 , Campbell Barton wrote:
>>
>>> Hi, I was wondering if this is possible or if it would be acceptable
>>> to disable progress printout.
>>>
>>> At the moment building with only minor changes prints a lot of text
>>> with CMake & Makefiles.
>>>
>>> eg:
>>> [  4%] Built target bf_intern_audaspace
>>> [  4%] Built target bf_intern_string
>>> [  6%] Built target bf_intern_ghost
>>>
>>> full log.
>>> http://www.pasteall.org/16053
>>>
>>> Setting: SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES OFF)
>>> is no good because I want to see the lines which are running/building,
>>> just not the progress lines that do nothing (the reverse really).
>>>
>>> I found some messages about this but they only refer to RULE_MESSAGES.
>>>
>>> This may seem silly but its actually one of the reasons we still have
>>> hand written makefiles in our project (which Im trying to get replaced
>>> with cmake).
>>>
>>> Would this be acceptable?
>>>
>>
>> what happens if you run "make VERBOSE=1" or enable CMAKE_VERBOSE_MAKEFILE?
>>
>> Michael
>>
>> --
>> There is always a well-known solution to every human problem -- neat, 
>> plausible, and wrong.
>> H. L. Mencken
>
> using verbose makefiles it gives a lot of output even when running a
> build with no changes to any C files.
> http://www.pasteall.org/16061
>
> Im pretty happy with cmake's current output, its just for doing
> rebuilds during development where only a few files change, the
> progress gets in the way of seeing output of the files which do
> rebuild.
>
> So I think it would be good to have a RULE_PROGRESS option, since I
> still want to see RULE_MESSAGES.

Im using CMake from GIT, and IIRC RULE_MESSAGES used to disable
progress, this link confirms.
http://www.itk.org/Bug/bug_view_advanced_page.php?bug_id=8726

but at the moment % progress is enabled whatever its set to.

-- 
- Campbell
___
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] Less Noisy Makefiles?

2010-10-07 Thread Campbell Barton
Hi, I was wondering if this is possible or if it would be acceptable
to disable progress printout.

At the moment building with only minor changes prints a lot of text
with CMake & Makefiles.

eg:
[  4%] Built target bf_intern_audaspace
[  4%] Built target bf_intern_string
[  6%] Built target bf_intern_ghost

full log.
http://www.pasteall.org/16053

Setting: SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES OFF)
is no good because I want to see the lines which are running/building,
just not the progress lines that do nothing (the reverse really).

I found some messages about this but they only refer to RULE_MESSAGES.

This may seem silly but its actually one of the reasons we still have
hand written makefiles in our project (which Im trying to get replaced
with cmake).

Would this be acceptable?

-- 
- Campbell
___
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] Visual Studio 2010 generator and custom command

2010-09-29 Thread Campbell Barton
On Wed, Sep 29, 2010 at 10:02 AM, elizabeta petreska
 wrote:
> Hi,
>
> I asked this question some time ago in the mailing list. Unfortunately, I
> did not try to resolve this issue since then, so I am trying again. :)
>
> I am using Visual Studio 2010 generator and cmake 2.8.2.
>
> Why the following custom command is runing all the time, although the input
> dependency ( myfile.txt ) is not changed ? With Visual Studio 2005 it is
> working ok.
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
> PROJECT(quick_test)
>
> ADD_CUSTOM_COMMAND(
>  OUTPUT "${PROJECT_BINARY_DIR}/$(ConfigurationName)/generated.txt"
>  COMMAND ${CMAKE_COMMAND} -E copy
>   "${PROJECT_SOURCE_DIR}/myfile.txt"
>   "${PROJECT_BINARY_DIR}/$(ConfigurationName)/generated.txt"
>  DEPENDS "${PROJECT_SOURCE_DIR}/myfile.txt"
>  )
> ADD_CUSTOM_TARGET(${PROJECT_NAME} DEPENDS
> "${PROJECT_BINARY_DIR}/$(ConfigurationName)/generated.txt")

Was just about to mail this list with the same problem, but using
Makefiles on linux so its probably not build system spesific.
Basically the command to generate always runs even if the inputs are
older then the outputs.

The only work around I can think of is to write a cmake script which
is called rather then the generator directly, this cmake script can do
the file comparisons to work out if generating the files is really
needed, but would prefer if this wasnt needed.
___
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