Re: [CMake] Diff output from CMake?

2011-09-13 Thread Federico Carminati
Dear All,
is there a way to specify the link command in CMake? If I specify

export LD=/usr/bin/ld ; cmake $MY_SOURCE_DIRECTORY

it is not taken and if I set 

cmake $MY_SOURCE_DIRECTORY \
 -DCMAKE_C_LINK_EXECUTABLE=ld \
 -DCMAKE_CXX_LINK_EXECUTABLE=ld

what I observe is that the entire link command is replaced by just ld. Am I 
missing something? 

[/Users/fca] cmake -version
cmake version 2.8.4.20110216-gaec6

Thanks a lot in advance for the help. Best, 

Federico Carminati
CERN-PH 
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 68505
Mobile: +41 76 487 4843

___
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] LINKER FLAGS

2011-09-13 Thread pellegrini

Hi all,

I would like to build a Fortran90 project using Fortran intel compiler. 
I would like to increase the stack by adding the /stack

flag to the linker.

Looking on the documentation, I think that set(CMAKE_EXE_LINKERS_FLAG 
/stack:6400) will do the job but I was wondering if using this 
command will remove the list of flags that may be set by cmake 
(behaviour that I would like to avoid) or just append it to this list ?


thanks

Eric

--
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France

___
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] Diff output from CMake?

2011-09-13 Thread Federico Carminati
Hello Johny,
   I am afraid not… here is what I get if I specify the full path

/usr/bin/ld

this is *all* the command, which of course fails. best,

Federico Carminati
CERN-PH
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 68505
Mobile: +41 76 487 4843

On 13 Sep 2011, at 09:57, Johny Jose wrote:

Hey Federico,

I believe you need to mention the absolute path of the ld executable in the 
value for the CMAKE_C_LINK_EXECUTABLE and the CMAKE_CXX_LINK_EXECUTABLE.

Cheers,
Johny



On 13 September 2011 13:14, Federico Carminati 
federico.carmin...@cern.chmailto:federico.carmin...@cern.ch wrote:
Dear All,
   is there a way to specify the link command in CMake? If I specify

export LD=/usr/bin/ld ; cmake $MY_SOURCE_DIRECTORY

it is not taken and if I set

cmake $MY_SOURCE_DIRECTORY \
 -DCMAKE_C_LINK_EXECUTABLE=ld \
 -DCMAKE_CXX_LINK_EXECUTABLE=ld

what I observe is that the entire link command is replaced by just ld. Am I 
missing something?

[/Users/fca] cmake -version
cmake version 2.8.4.20110216-gaec6

Thanks a lot in advance for the help. Best,

Federico Carminati
CERN-PH
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 68505
Mobile: +41 76 487 4843

___
Powered by www.kitware.comhttp://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] Specify the link command in CMake

2011-09-13 Thread Eric Noulard
2011/9/13 Federico Carminati federico.carmin...@cern.ch:
 Dear All,
is there a way to specify the link command in CMake? If I specify

 export LD=/usr/bin/ld ; cmake $MY_SOURCE_DIRECTORY

 it is not taken and if I set

I dont' know if LD env var is supposed to be used at all.

 cmake $MY_SOURCE_DIRECTORY \
  -DCMAKE_C_LINK_EXECUTABLE=ld \
  -DCMAKE_CXX_LINK_EXECUTABLE=ld

 what I observe is that the entire link command is replaced by just ld. Am 
 I missing something?

What are you trying to do?
Replacing the linker application while keeping the option of the one
CMake would have chosen?
Seems weird, if you change linker may be you should specify linker
option as well, no?

This looks like incomplete cross compiling (see
http://www.cmake.org/Wiki/CMake_Cross_Compiling)
or unsupported compiler use.

May be you can explain us what you are trying to do.
and please do not hijack unrelated thread for asking new question.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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] Specify the link command in CMake

2011-09-13 Thread Federico Carminati
Hello Eric,
   sorry for not having changed the subject, I realize it only now. Thanks for 
your answer. I am trying to use clang / clang++. This works if I do 

cmake $MY_SOURCE_DIRECTORY  -DCMAKE_C_COMPILER=clang  
-DCMAKE_CXX_COMPILER=clang++ 

however CMake decides to use clang / clang++ as linker, and I need plain ld. 
However I am fine with all other flags and arguments. I would just like to have 
ld as linker command and not clang / clang++. I tried adding

 -DCMAKE_C_LINK_EXECUTABLE=ld \
 -DCMAKE_CXX_LINK_EXECUTABLE=ld

with the result that the whole linker command is now just what I specify as 
argument to CMAKE_LANG_LINK_EXECUTABLE, I do not even have the executable, 
object files and libraries any more. Thanks for help and best regards, 

Federico Carminati
CERN-PH 
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 68505
Mobile: +41 76 487 4843

On 13 Sep 2011, at 10:56, Eric Noulard wrote:

 2011/9/13 Federico Carminati federico.carmin...@cern.ch:
 Dear All,
   is there a way to specify the link command in CMake? If I specify
 
 export LD=/usr/bin/ld ; cmake $MY_SOURCE_DIRECTORY
 
 it is not taken and if I set
 
 I dont' know if LD env var is supposed to be used at all.
 
 cmake $MY_SOURCE_DIRECTORY \
 -DCMAKE_C_LINK_EXECUTABLE=ld \
 -DCMAKE_CXX_LINK_EXECUTABLE=ld
 
 what I observe is that the entire link command is replaced by just ld. 
 Am I missing something?
 
 What are you trying to do?
 Replacing the linker application while keeping the option of the one
 CMake would have chosen?
 Seems weird, if you change linker may be you should specify linker
 option as well, no?
 
 This looks like incomplete cross compiling (see
 http://www.cmake.org/Wiki/CMake_Cross_Compiling)
 or unsupported compiler use.
 
 May be you can explain us what you are trying to do.
 and please do not hijack unrelated thread for asking new question.
 
 -- 
 Erk
 Membre de l'April - « promouvoir et défendre le logiciel libre » -
 http://www.april.org

___
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] Running unit test as part of the build

2011-09-13 Thread Michael Wild
On 09/12/2011 09:06 PM, Erik Johansson wrote:
 On Mon, Sep 12, 2011 at 20:30, Michael Wild them...@gmail.com wrote:
 How about using a custom command that runs the unit test using a
 wrapper script that upon successful completion creates a stamp-file and
 depends upon the unit-test executable target itself?
 
 This seems to work:
 
 add_executable(unittest ${test_SRCS})
 
 set(unittest_stamp
   ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/unittest.stamp)
 add_custom_command(OUTPUT ${unittest_stamp}
   COMMAND ${CMAKE_CTEST_COMMAND} $(ARGS)
   COMMAND ${CMAKE_COMMAND} -E touch ${unittest_stamp}
   COMMENT Running unit test
   DEPENDS unittest)
 add_custom_target(unittest_run ALL DEPENDS ${unittest_stamp})
 
 // Erik
 

I think the OP wanted to run the tests individually, so I don't think
you should be using CMAKE_CTEST_COMMAND, but rather the unittest
executable directly, such that only tests that failed or where the test
executable changed are re-run.


E.g.:

###
cmake_minimum_required(VERSION 2.8)
project(tests CXX)

# usually one would put this in a proper file, not WRITE it like this
file(WRITE ${CMAKE_BINARY_DIR}/run_test.cmake 
if(NOT EXISTS \${TEST_EXE})
  message(FATAL_ERROR \'\${TEST_EXE}' does not exist\)
endif()
execute_process(COMMAND \${TEST_EXE}
  RESULT_VARIABLE result)
if(result)
  message(\\${TEST_NAME} failed\)
else()
  execute_process(COMMAND \${CMAKE_COMMAND} -E touch \${TEST_STAMP})
endif()
)

# create some tests, number 2 fails
file(WRITE ${CMAKE_BINARY_DIR}/test.cpp.in 
// need to sleep a bit for the time stamps to work...
#include unistd.h
int main() {sleep(1); return @exit_status@;}
)
foreach(i RANGE 1 3)
  if(i EQUAL 2)
set(exit_status 1)
  else()
set(exit_status 0)
  endif()
  configure_file(${CMAKE_BINARY_DIR}/test.cpp.in
${CMAKE_BINARY_DIR}/test${i}.cpp @ONLY)
endforeach()

add_custom_target(alltests ALL)
foreach(t test1 test2 test3)
  add_executable(unit${t} ${CMAKE_BINARY_DIR}/${t}.cpp)
  set(stamp
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/unit${t}.stamp)
  add_custom_command(OUTPUT ${stamp}
COMMAND ${CMAKE_COMMAND} -DTEST_NAME=${t}
  -DTEST_EXE=$TARGET_FILE:unit${t} -DTEST_STAMP=${stamp}
  -P ${CMAKE_BINARY_DIR}/run_test.cmake
COMMENT Running unit test ${t}
DEPENDS unit${t})
  add_custom_target(run_${t} ALL DEPENDS ${stamp})
  add_dependencies(alltests run_${t})
endforeach()
###

HTH

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


Re: [CMake] LINKER FLAGS

2011-09-13 Thread Eric Noulard
2011/9/13 pellegrini pellegr...@ill.fr:
 Hi all,

 I would like to build a Fortran90 project using Fortran intel compiler. I
 would like to increase the stack by adding the /stack
 flag to the linker.

 Looking on the documentation, I think that set(CMAKE_EXE_LINKERS_FLAG
 /stack:6400) will do the job but I was wondering if using this command
 will remove the list of flags that may be set by cmake (behaviour that I
 would like to avoid) or just append it to this list ?

May be you can try?
Beware that S is to be put at FLAG**S** and not at LINKER
i.e.
CMAKE_EXE_LINKER_FLAGS
and not
CMAKE_EXE_LINKERS_FLAG


Note that if you can do that on a per-target basis using the LINK_FLAGS property
LINK_FLAGS
   Additional flags to use when linking this target.

   The LINK_FLAGS property can be used to add extra flags to the link
   step of a target.  LINK_FLAGS_CONFIG will add to the configuration
   CONFIG, for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDEBINFO.

which is just doing what you want that is adds extra flags for this
particular target.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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] LINKER FLAGS

2011-09-13 Thread Michael Wild
On 09/13/2011 10:35 AM, pellegrini wrote:
 Hi all,
 
 I would like to build a Fortran90 project using Fortran intel compiler.
 I would like to increase the stack by adding the /stack
 flag to the linker.
 
 Looking on the documentation, I think that set(CMAKE_EXE_LINKERS_FLAG
 /stack:6400) will do the job but I was wondering if using this
 command will remove the list of flags that may be set by cmake
 (behaviour that I would like to avoid) or just append it to this list ?
 
 thanks
 
 Eric
 

set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} /stack:6400)

Also, if you want to apply this to only a single target, you should
probably use the LINK_FLAGS target property instead. There you don't
have to worry about appending.

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


Re: [CMake] LINKER FLAGS

2011-09-13 Thread pellegrini

thanks for the hint Eric  Michael

Eric

Michael Wild a écrit :

On 09/13/2011 10:35 AM, pellegrini wrote:
  

Hi all,

I would like to build a Fortran90 project using Fortran intel compiler.
I would like to increase the stack by adding the /stack
flag to the linker.

Looking on the documentation, I think that set(CMAKE_EXE_LINKERS_FLAG
/stack:6400) will do the job but I was wondering if using this
command will remove the list of flags that may be set by cmake
(behaviour that I would like to avoid) or just append it to this list ?

thanks

Eric




set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} /stack:6400)

Also, if you want to apply this to only a single target, you should
probably use the LINK_FLAGS target property instead. There you don't
have to worry about appending.

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
  



--
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France

___
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 CMake for Eclipse Indigo / CDT 8

2011-09-13 Thread svdbg
Hello,

I usually develop with Visual STudio, but I have to code now on Eclipse so that 
my software is runnable on Linux.
I so installed the last release of Eclipse, and want to run CMake 2.8.5 to 
export an Eclipse project.
The solutions/projects that CMake generated for Visual are OK.

When I run the CMake file with the CDT generator, it generates several files :

CMakeCache.txt
cmake_install.cmake
config.h
Makefile
ProfileBuild.cmake
.cproject
.project

In Eclipse CDT, when I want to import a CDT project, it asks for a XML file 
(xml extension).
What am I supposed to do ?

Thanks.
___
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 CMake for Eclipse Indigo / CDT 8

2011-09-13 Thread Eric Noulard
2011/9/13  sv...@free.fr:
 Hello,

 I usually develop with Visual STudio, but I have to code now on Eclipse so 
 that my software is runnable on Linux.
 I so installed the last release of Eclipse, and want to run CMake 2.8.5 to 
 export an Eclipse project.
 The solutions/projects that CMake generated for Visual are OK.

 When I run the CMake file with the CDT generator, it generates several files :

 CMakeCache.txt
 cmake_install.cmake
 config.h
 Makefile
 ProfileBuild.cmake
 .cproject
 .project

 In Eclipse CDT, when I want to import a CDT project, it asks for a XML file 
 (xml extension).

Which menu are you using to try the import?
I do not observe the same behavior (no xml file required)

 What am I supposed to do ?

.cproject and .project are xml files.

Did you try what's described here:
http://www.vtk.org/Wiki/Eclipse_CDT4_Generator

http://www.vtk.org/Wiki/CMake:Eclipse_UNIX_Tutorial

It was written for CDT4 but it looks as if its works for me with CDT8 (Indigo)
I do Import Existing Projects into workspace select the builddir and
the project is found
and imported withtout trouble.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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-13 Thread Clifford Yapp
On Sun, Sep 11, 2011 at 11:01 PM, Peter Collingbourne pe...@pcc.me.ukwrote:


  It looks like various custom commands aren't running (some tcl related
  stuff, docbook documentation generation) - are custom commands currently
  supported?

 Yes, custom commands and targets are supported.  There was a bug (which
 is now fixed) that caused custom commands not be built by default.  Now
 all targets except those marked EXCLUDE_FROM_ALL are built by default.


With latest pull from this weekend, I'm currently getting:

ninja cmTryCompileExec

  ninja: error: loading 'build.ninja': line 21, col 9: in 'rules.ninja':
line
  38, col 3: unexpected variable 'restat'

Cheers,
CY
___
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 CMake for Eclipse Indigo / CDT 8

2011-09-13 Thread svdbg
 Which menu are you using to try the import?

Here was the error : I was trying to import a C++ project.

 I do not observe the same behavior (no xml file required)

 .cproject and .project are xml files.

Yes, but without the XML extension. :-)

 Did you try what's described here:
 http://www.vtk.org/Wiki/Eclipse_CDT4_Generator

Now, yes. So it is OK.

Thanks !
___
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-13 Thread Peter Collingbourne
On Tue, Sep 13, 2011 at 08:40:32AM -0400, Clifford Yapp wrote:
 On Sun, Sep 11, 2011 at 11:01 PM, Peter Collingbourne pe...@pcc.me.ukwrote:
 
 
   It looks like various custom commands aren't running (some tcl related
   stuff, docbook documentation generation) - are custom commands currently
   supported?
 
  Yes, custom commands and targets are supported.  There was a bug (which
  is now fixed) that caused custom commands not be built by default.  Now
  all targets except those marked EXCLUDE_FROM_ALL are built by default.
 
 
 With latest pull from this weekend, I'm currently getting:
 
 ninja cmTryCompileExec
 
   ninja: error: loading 'build.ninja': line 21, col 9: in 'rules.ninja':
 line
   38, col 3: unexpected variable 'restat'

Try using this branch of Ninja:

https://github.com/pcc/Ninja/tree/restat

The 'restat' branch is still under development, so this requirement
will go away once 'restat' is merged into the main branch of Ninja.

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


Re: [CMake] VS 2010 macro

2011-09-13 Thread James Bigler
On Tue, Aug 30, 2011 at 9:11 AM, Bill Hoffman bill.hoff...@kitware.comwrote:

 On 8/30/2011 4:11 AM, Andrea Galeazzi wrote:

 Hi,
 I'd like to know if the bug 0011258
 http://public.kitware.com/**Bug/view.php?id=11258http://public.kitware.com/Bug/view.php?id=11258
 will be fixed or the

 community simply decided to give it up.
 Any changes for 0012294 to be assigned?


 I don't think we have given up, but we are certainly at a technical
 roadblock.   No really has a solution that will work consistently.

 To give a background, the auto-running of cmake when input files change,
 and the subsequent reloading of the project in the VS 10 IDE is not always
 working.  In VS 8 and 9, we have a solution that works pretty well.   It
 does something like this:


 1. cmake is run when any of its input files are changed
 2. if cmake finds a running VS IDE that has the same project loaded
   - It pops up a dialog that gives the user the chance to:
  - stop the current build and reload the project

 This is done with a VS macro that is installed by cmake.

 This fails to work well in VS 10.

 -Bill

 __**_
 Powered by www.kitware.com

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

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

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


Is it not possible to have two macros?  One for VS 2010 and one for
earlier?  I know you dislike code divergence, but you already have different
code paths already for the generators.  It doesn't seem much of a stretch to
have separate macros for multiple versions of VS.  The bug seems to indicate
that there are working solutions for both VS 2010 and VS 2008, but they are
different.

James
___
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] cmLocalGenerator::GenerateInstallRules() needlessly slow?/missing optimization?

2011-09-13 Thread Alexander Neundorf
On Wednesday, September 07, 2011 11:12:55 AM Andreas Mohr wrote:
 Hi,
 
 just saw that the main cmake_install.cmake contains (at the end):
 
 FILE(WRITE
 [${CMAKE_BINARY_DIR}]/${CMAKE_INSTALL_MANIFEST}
 )
 FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})
   FILE(APPEND
 [${CMAKE_BINARY_DIR}]/${CMAKE_INSTALL_MANIFEST}
 ${file}\n)
 ENDFOREACH(file)
 
 as generated by CMake git
 Source/cmLocalGenerator.cxx/cmLocalGenerator::GenerateInstallRules()
 
 Depending on actual implementation of CMake (whether it has some caching
 logic or not), this might be woefully inefficient,
 causing a possibly _filesystem-bound_ file append for each line.

Without checking, AFAIK it hasn't.
But, I never had the impression that this part of make install would be 
slow, so I'm not sure it is worth it.
Did you notice slow install behaviour ?

Alex
___
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] question about Eclipse CDT Generators

2011-09-13 Thread Alexander Neundorf
On Tuesday, September 06, 2011 06:53:23 PM cheshirekow wrote:
 Hi cmake list,
 
 I'm using cmake to manage a CUDA project, and I'm generating an eclipse
 project for development.
 
 Since CDT doesn't natively understand the output from the nvidia
 compiler, I've created a new regex error parser (I'm using eclipse 3.7
 but I heard 3.6 has this ability as well), however, in the project
 generated by cmake, I cannot add this error parser. It does not appear
 in the list of check boxes. I'm trying to figure out why.
 
 I've tried creating a new C/C++ makefile project, and my custom error
 parser does appear in there. I compared the .project and .cproject files
 from both the cmake generated project and the dummy makefile project
 from the CDT new project wizard. They look very different. In addition,
 when I look at the project properties dialog for the cmake generated
 project, the options available are different then one from an eclipse
 wizard generated project. They are:
 
 C/C++ General
 C/C++ Include Paths and Symbols
 C/C++ Make Project
 C/C++ Project Paths
 
 Whereas, when using the new project wizard from CDT I get
 
 C/C++ Build
 C/C++ General
 
 In the cmake generated project, error parsers are listed under C/C++
 Make Project. In the eclipse generated project, error parsers are listed
 under C/C++ Build-settings.
 
 Does anyone understand why the cmake generated project is different from
 the eclipse generated project? Is it because cmake is generating project
 files for an older version of CDT? Is there a way to make it the same
 and use my custom parser?

Please create an entry in the cmake bug tracker for this: 
http://public.kitware.com/Bug

Thanks
Alex
___
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] Diff output from CMake?

2011-09-13 Thread Alexander Neundorf
On Tuesday, September 13, 2011 05:07:00 AM Clifford Yapp wrote:
 I am trying to compare two large lists of file paths (about 14,000 lines
 each) to identify which entries in each list are missing from the other,
 and while I can get CMake to do it I must be doing it the wrong way
 because the results are hideously slow.
 
 I currently generate two files with the paths and then read them in as
 lists, using LIST() commands to peform STREQUAL tests.  I was hoping to

How do you do that ?
Do you iterate over one list using foreach() and then list(FIND) to check 
whether it exists in the other list ?

Internally, every cmake variable is stored as a plain std::string.
When using a list() command, this string is converted to a 
std::vectorstd::string, and then cmake operates on this vector.
So if you do this 14000 times, each time a 14000 std::strings are created, 
which makes this O(n^2) I think.

Maybe something like this works ?

set(uniqueItems ${list1} ${list2})
list(REMOVE_DUPLICATES uniqueItems )

Or maybe you can do something with sorting both lists first.

Alex
___
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] Diff output from CMake?

2011-09-13 Thread David Cole
On Tue, Sep 13, 2011 at 1:39 PM, Alexander Neundorf
a.neundorf-w...@gmx.net wrote:
 On Tuesday, September 13, 2011 05:07:00 AM Clifford Yapp wrote:
 I am trying to compare two large lists of file paths (about 14,000 lines
 each) to identify which entries in each list are missing from the other,
 and while I can get CMake to do it I must be doing it the wrong way
 because the results are hideously slow.

 I currently generate two files with the paths and then read them in as
 lists, using LIST() commands to peform STREQUAL tests.  I was hoping to

 How do you do that ?
 Do you iterate over one list using foreach() and then list(FIND) to check
 whether it exists in the other list ?

 Internally, every cmake variable is stored as a plain std::string.
 When using a list() command, this string is converted to a
 std::vectorstd::string, and then cmake operates on this vector.
 So if you do this 14000 times, each time a 14000 std::strings are created,
 which makes this O(n^2) I think.

 Maybe something like this works ?

 set(uniqueItems ${list1} ${list2})
 list(REMOVE_DUPLICATES uniqueItems )

 Or maybe you can do something with sorting both lists first.

 Alex
 ___
 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


I don't know if this will help at all, but diff is available within
the msysGit installation. (Don't know if your project uses git or not,
but if it does, you could use the diff installed with git...)

And another point of interest: there's a test in the CMake test suite
that does use diff if it's available. In case it's not available,
the easy fall-back in that test is to emit the full output when
compare_files returns that there are diffs, so that a human
inspecting it later can see the diffs by eye, or with a diff tool on a
machine where it *is* available... The script
Tests/CMakeTestMultipleConfigures/RunCMake.cmake contains the cmake
script code described here.

I realize this same technique will not be very useful with files
14,000 lines long... but thought I'd mention it so you could look at
it and perhaps draw inspiration from it.

If you could pass along the code that you're using, we might be able
to suggest a better way to achieve the same thing within the CMake
language if that's absolutely necessary.


HTH,
David
___
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] Diff output from CMake?

2011-09-13 Thread Clifford Yapp
On Tue, Sep 13, 2011 at 1:58 PM, David Cole david.c...@kitware.com wrote:

 On Tue, Sep 13, 2011 at 1:39 PM, Alexander Neundorf
 a.neundorf-w...@gmx.net wrote:
  On Tuesday, September 13, 2011 05:07:00 AM Clifford Yapp wrote:
  I am trying to compare two large lists of file paths (about 14,000 lines
  each) to identify which entries in each list are missing from the other,
  and while I can get CMake to do it I must be doing it the wrong way
  because the results are hideously slow.
 
  I currently generate two files with the paths and then read them in as
  lists, using LIST() commands to peform STREQUAL tests.  I was hoping to
 
  How do you do that ?
  Do you iterate over one list using foreach() and then list(FIND) to check
  whether it exists in the other list ?


I tried a couple of ways, most of them variations on that theme (BUILD_FILES
and SVN_FILES are two manifest lists, and I need items from each list that
are not in the other list)

FOREACH(ITEM ${BUILD_FILES})
 LIST(FIND ${ITEM} SVN_FILES POS)
 IF(NOT POS STREQUAL -1)
LIST(REMOVE_ITEM SVN_FILES ${ITEM})
LIST(REMOVE_ITEM BUILD_FILES ${ITEM})
 ENDIF()
ENDFOREACH()

In essence, the idea is BUILD_FILES will end  up holding items unique to
BUILD_FILES and SVN_FILES will end up holding items unique to SVN_FILES,
which are the two pieces of information I'm after.


  Internally, every cmake variable is stored as a plain std::string.
  When using a list() command, this string is converted to a
  std::vectorstd::string, and then cmake operates on this vector.
  So if you do this 14000 times, each time a 14000 std::strings are
 created,
  which makes this O(n^2) I think.
 
  Maybe something like this works ?
 
  set(uniqueItems ${list1} ${list2})
  list(REMOVE_DUPLICATES uniqueItems )


I thought about REMOVE_DUPLICATES, but if I understand correctly wouldn't
that give me the union of the two lists?  I need everything not present in
both lists.


 I realize this same technique will not be very useful with files
 14,000 lines long... but thought I'd mention it so you could look at
 it and perhaps draw inspiration from it.


Basically I'm currently trying a variation on that, except I'm trying to get
a cross-platform comparing tool working that I can guarantee will be there -
I'm trying comm at the moment but I'm not sure comm's notions of what
consistute a sorted file and CMake's LIST(SORT are compatible when it comes
to things like .file and ~file.


 If you could pass along the code that you're using, we might be able
 to suggest a better way to achieve the same thing within the CMake
 language if that's absolutely necessary.


Currently (using comm) I'm doing this (replacing /. with /tmpdot in an
attempt to let comm handle the sorted output):

STRING(REGEX REPLACE /\\. /tmpdot BUILD_FILES ${BUILD_FILES})
STRING(REGEX REPLACE /\\. /tmpdot SVN_FILES ${SVN_FILES})
LIST(SORT BUILD_FILES)
LIST(SORT SVN_FILES)
STRING(REGEX REPLACE ; \n BUILD_FILES ${BUILD_FILES})
STRING(REGEX REPLACE ; \n SVN_FILES ${SVN_FILES})
FILE(WRITE @CMAKE_BINARY_DIR@/build_files_list.txt ${BUILD_FILES})
FILE(WRITE @CMAKE_BINARY_DIR@/svn_files_list.txt ${SVN_FILES})
STRING(REGEX REPLACE \n ; BUILD_FILES ${BUILD_FILES})
STRING(REGEX REPLACE \n ; SVN_FILES ${SVN_FILES})

EXECUTE_PROCESS(COMMAND @CMAKE_BINARY_DIR@/@BIN_DIR@/comm -3
@CMAKE_BINARY_DIR@/build_files_list.txt @CMAKE_BINARY_DIR@/svn_files_list.txt
OUTPUT_VARIABLE COMM_RAWOUT)
STRING(REGEX REPLACE \n ; COMM_OUT ${COMM_RAWOUT})
STRING(REGEX REPLACE /tmpdot /. COMM_OUT ${COMM_OUT})
STRING(REGEX REPLACE   COMM_OUT ${COMM_OUT})

FOREACH(ITEM ${COMM_OUT})
   LIST(FIND BUILD_FILES ${ITEM} INBUILD)
   LIST(FIND SVN_FILES ${ITEM} INSVN)
   IF(INBUILD STREQUAL -1 AND NOT INSVN STREQUAL -1)
  LIST(APPEND SVN_FILES_NOT_IN_BUILD ${ITEM})
  LIST(REMOVE_ITEM COMM_OUT ${ITEM})
   ENDIF(INBUILD STREQUAL -1 AND NOT INSVN STREQUAL -1)
   IF(INSVN STREQUAL -1 AND NOT INBUILD STREQUAL -1)
  LIST(APPEND BUILD_FILES_NOT_IN_SVN ${ITEM})
  LIST(REMOVE_ITEM COMM_OUT ${ITEM})
   ENDIF(INSVN STREQUAL -1 AND NOT INBUILD STREQUAL -1)
ENDFOREACH(ITEM ${COMM_OUT})

I was hoping that CMake's diff ability might indicate lurking in there was
the ability to get actual diff style output from a cmake -E command that
could be parsed (if CMake had sucked in openbsd's diff to implement its diff
abilities, for example) but if not it looks like performance considerations
will require ensuring some sort of cross-platform tool is available.  Would
it perhaps make sense to  have a cmake -E diff the same way there is a cmake
-E tar?

The broader context is implementing a make distcheck rule for BRL-CAD
along the lines of the one previously implemented in autotools - the idea is
to have subversion tell us what files are in the repository (svn info), have
the build system report what files it knows about (via some custom CMake
function/macro logic that we have working to record that) and crank that
information back into 

Re: [CMake] cmLocalGenerator::GenerateInstallRules() needlessly slow?/missing optimization?

2011-09-13 Thread Andreas Mohr
On Tue, Sep 13, 2011 at 03:33:01PM +0200, Alexander Neundorf wrote:
 On Wednesday, September 07, 2011 11:12:55 AM Andreas Mohr wrote:
  Depending on actual implementation of CMake (whether it has some caching
  logic or not), this might be woefully inefficient,
  causing a possibly _filesystem-bound_ file append for each line.
 
 Without checking, AFAIK it hasn't.
 But, I never had the impression that this part of make install would be 
 slow, so I'm not sure it is worth it.

Yeah, I'm afraid it's not a hotpath, thus it's not necessarily worth
optimizing.

 Did you notice slow install behaviour ?

No, it simply occurred to me that this construct might be a lot more
inefficient than storing content of a helper array...
One would probably have to analyse an strace trace (or some such)
of a full install to be able to pinpoint specifics.

Andreas Mohr
___
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] Diff output from CMake?

2011-09-13 Thread Eric Noulard
2011/9/13 Clifford Yapp cliffy...@gmail.com:


 On Tue, Sep 13, 2011 at 1:58 PM, David Cole david.c...@kitware.com wrote:

 On Tue, Sep 13, 2011 at 1:39 PM, Alexander Neundorf
 a.neundorf-w...@gmx.net wrote:
  On Tuesday, September 13, 2011 05:07:00 AM Clifford Yapp wrote:
  I am trying to compare two large lists of file paths (about 14,000
  lines
  each) to identify which entries in each list are missing from the
  other,
  and while I can get CMake to do it I must be doing it the wrong way
  because the results are hideously slow.
 
  I currently generate two files with the paths and then read them in as
  lists, using LIST() commands to peform STREQUAL tests.  I was hoping to
 
  How do you do that ?
  Do you iterate over one list using foreach() and then list(FIND) to
  check
  whether it exists in the other list ?

 I tried a couple of ways, most of them variations on that theme (BUILD_FILES
 and SVN_FILES are two manifest lists, and I need items from each list that
 are not in the other list)

 FOREACH(ITEM ${BUILD_FILES})
  LIST(FIND ${ITEM} SVN_FILES POS)
  IF(NOT POS STREQUAL -1)
     LIST(REMOVE_ITEM SVN_FILES ${ITEM})
     LIST(REMOVE_ITEM BUILD_FILES ${ITEM})
  ENDIF()
 ENDFOREACH()

 In essence, the idea is BUILD_FILES will end  up holding items unique to
 BUILD_FILES and SVN_FILES will end up holding items unique to SVN_FILES,
 which are the two pieces of information I'm after.

If  I understand it well you want to compute symmetric difference.

Assuming BUILD_FILES and SVN_FILES initially contains  the whole list of names.
Then could you try:

set(BUILD_FILES_UNIQUE ${BUILD_FILES})
set(SVN_FILES_UNIQUE ${SVN_FILES})
list(REMOVE_ITEM BUILD_FILES_UNIQUE ${SVN_FILES})
list(REMOVE_ITEM SVN_FILES_UNIQUE ${BUILD_FILES})

I don't know about the performance of this with huge list but after that
BUILD_FILES_UNIQUE and SVN_FILES_UNIQUE should contains what you want.
at least it work on my small (attached) example.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org

set(LIST1 a;b;c;g;q)
set(LIST2 a;b;d;c;h;g)
message(LIST1 = ${LIST1})
message(LIST2 = ${LIST2})

set(LIST1_UNIQUE ${LIST1})
set(LIST2_UNIQUE ${LIST2})
message(LIST1_UNIQUE = ${LIST1_UNIQUE})
message(LIST2_UNIQUE = ${LIST2_UNIQUE})

list(REMOVE_ITEM LIST1_UNIQUE ${LIST2})
list(REMOVE_ITEM LIST2_UNIQUE ${LIST1})
message(LIST1_UNIQUE = ${LIST1_UNIQUE})
message(LIST2_UNIQUE = ${LIST2_UNIQUE})___
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] Diff output from CMake?

2011-09-13 Thread Clifford Yapp
On Tue, Sep 13, 2011 at 3:52 PM, Clifford Yapp cliffy...@gmail.com wrote:

 (if CMake had sucked in openbsd's diff to implement its diff abilities, for
 example)


Ah, nevermind - I see the key file still has the advertising clause BSD.
Scratch that.
___
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] Diff output from CMake?

2011-09-13 Thread Clifford Yapp
Eric -

Excellent!  That looks like it will do the trick.

Thank you!

CY

On Tue, Sep 13, 2011 at 4:53 PM, Eric Noulard eric.noul...@gmail.comwrote:


 If  I understand it well you want to compute symmetric difference.

 Assuming BUILD_FILES and SVN_FILES initially contains  the whole list of
 names.
 Then could you try:

 set(BUILD_FILES_UNIQUE ${BUILD_FILES})
 set(SVN_FILES_UNIQUE ${SVN_FILES})
 list(REMOVE_ITEM BUILD_FILES_UNIQUE ${SVN_FILES})
 list(REMOVE_ITEM SVN_FILES_UNIQUE ${BUILD_FILES})

 I don't know about the performance of this with huge list but after that
 BUILD_FILES_UNIQUE and SVN_FILES_UNIQUE should contains what you want. at
 least it work on my small (attached) example.


___
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] creating a library -- folder layout??

2011-09-13 Thread Cristobal Navarro
hello everyone!
this is my first post on the mailing list

i am making a shared library
i have everything configured properly so that cmake creates de makefile
scripts as espected

at the moment cmake is installing my library by default into:

/usr/local/lib/mylib.so.0.1 (and the symlink mylib.so)
/usr/local/include/mylib.h

my question is, how can i make it to install into it's own folder?? so
everything lays inside

/usr/local/mylib-0.1/...

thanks in advance
best regards
Cristobal
___
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] creating a library -- folder layout??

2011-09-13 Thread Eric Noulard
2011/9/13 Cristobal Navarro axisch...@gmail.com:
 hello everyone!
 this is my first post on the mailing list
 i am making a shared library
 i have everything configured properly so that cmake creates de makefile
 scripts as espected
 at the moment cmake is installing my library by default into:
 /usr/local/lib/mylib.so.0.1 (and the symlink mylib.so)
 /usr/local/include/mylib.h
 my question is, how can i make it to install into it's own folder?? so
 everything lays inside
 /usr/local/mylib-0.1/...

use the DESTINATION argument of the INSTALL CMake command.
and/or read the whole doc of the INSTALL CMake command.

i.e.

install(TARGETS mylib DESTINATION mylib-0.1)

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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] Diff output from CMake?

2011-09-13 Thread Eric Noulard
2011/9/13 Clifford Yapp cliffy...@gmail.com:
 Eric -

 Excellent!  That looks like it will do the trick.

 Thank you!

Please tell us about the performance but from the implementation of REMOVE_ITEM
I bet the performance shouldn't be that good:

inside cmListCommand.cxx:

bool cmListCommand
::HandleRemoveItemCommand(std::vectorstd::string const args)

is using std::vectorstd::string (as Alex said) but the algorithm
used for ITEM removal seems suboptimal.

The two for loops may be merged in a single loop and avoid the
erase call alltogether.


If you are hitting a performance wall with the REMOVE_ITEM solution
you may try to patch that.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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] Running unit test as part of the build

2011-09-13 Thread Michael Hertling
On 09/13/2011 11:05 AM, Michael Wild wrote:
 On 09/12/2011 09:06 PM, Erik Johansson wrote:
 On Mon, Sep 12, 2011 at 20:30, Michael Wild them...@gmail.com wrote:
 How about using a custom command that runs the unit test using a
 wrapper script that upon successful completion creates a stamp-file and
 depends upon the unit-test executable target itself?

 This seems to work:

 add_executable(unittest ${test_SRCS})

 set(unittest_stamp
   ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/unittest.stamp)
 add_custom_command(OUTPUT ${unittest_stamp}
   COMMAND ${CMAKE_CTEST_COMMAND} $(ARGS)
   COMMAND ${CMAKE_COMMAND} -E touch ${unittest_stamp}
   COMMENT Running unit test
   DEPENDS unittest)
 add_custom_target(unittest_run ALL DEPENDS ${unittest_stamp})

 // Erik

 
 I think the OP wanted to run the tests individually, so I don't think
 you should be using CMAKE_CTEST_COMMAND, but rather the unittest
 executable directly, such that only tests that failed or where the test
 executable changed are re-run.
 
 
 E.g.:
 
 ###
 cmake_minimum_required(VERSION 2.8)
 project(tests CXX)
 
 # usually one would put this in a proper file, not WRITE it like this
 file(WRITE ${CMAKE_BINARY_DIR}/run_test.cmake 
 if(NOT EXISTS \${TEST_EXE})
   message(FATAL_ERROR \'\${TEST_EXE}' does not exist\)
 endif()
 execute_process(COMMAND \${TEST_EXE}
   RESULT_VARIABLE result)
 if(result)
   message(\\${TEST_NAME} failed\)
 else()
   execute_process(COMMAND \${CMAKE_COMMAND} -E touch \${TEST_STAMP})
 endif()
 )
 
 # create some tests, number 2 fails
 file(WRITE ${CMAKE_BINARY_DIR}/test.cpp.in 
 // need to sleep a bit for the time stamps to work...
 #include unistd.h
 int main() {sleep(1); return @exit_status@;}
 )
 foreach(i RANGE 1 3)
   if(i EQUAL 2)
 set(exit_status 1)
   else()
 set(exit_status 0)
   endif()
   configure_file(${CMAKE_BINARY_DIR}/test.cpp.in
 ${CMAKE_BINARY_DIR}/test${i}.cpp @ONLY)
 endforeach()
 
 add_custom_target(alltests ALL)
 foreach(t test1 test2 test3)
   add_executable(unit${t} ${CMAKE_BINARY_DIR}/${t}.cpp)
   set(stamp
 ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/unit${t}.stamp)
   add_custom_command(OUTPUT ${stamp}
 COMMAND ${CMAKE_COMMAND} -DTEST_NAME=${t}
   -DTEST_EXE=$TARGET_FILE:unit${t} -DTEST_STAMP=${stamp}
   -P ${CMAKE_BINARY_DIR}/run_test.cmake
 COMMENT Running unit test ${t}
 DEPENDS unit${t})
   add_custom_target(run_${t} ALL DEPENDS ${stamp})
   add_dependencies(alltests run_${t})
 endforeach()
 ###
 
 HTH
 
 Michael

Alternatively, you might run the test as a POST_BUILD custom command
which is attached to the unit test executable's target; look here:

# CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(UNITTEST C)
ENABLE_TESTING()
SET(CMAKE_VERBOSE_MAKEFILE ON)
FILE(WRITE ${CMAKE_BINARY_DIR}/pass.c int main(void){return 0;}\n)
ADD_EXECUTABLE(pass EXCLUDE_FROM_ALL pass.c)
ADD_TEST(NAME pass COMMAND pass)
ADD_CUSTOM_COMMAND(TARGET pass POST_BUILD COMMAND ${CMAKE_COMMAND}
-DTEST=pass
-DTARGET=$TARGET_FILE:pass
-P ${CMAKE_SOURCE_DIR}/unittest.cmake)
FILE(WRITE ${CMAKE_BINARY_DIR}/fail.c int main(void){return 1;}\n)
ADD_EXECUTABLE(fail EXCLUDE_FROM_ALL fail.c)
ADD_TEST(NAME fail COMMAND fail)
ADD_CUSTOM_COMMAND(TARGET fail POST_BUILD COMMAND ${CMAKE_COMMAND}
-DTEST=fail
-DTARGET=$TARGET_FILE:fail
-P ${CMAKE_SOURCE_DIR}/unittest.cmake)

# unittest.cmake:
EXECUTE_PROCESS(
COMMAND ${CMAKE_CTEST_COMMAND} -R ${TEST}
RESULT_VARIABLE RESULT)
IF(NOT RESULT EQUAL 0)
FILE(REMOVE ${TARGET})
MESSAGE(FATAL_ERROR Test ${TEST} [${TARGET}] failed.)
ENDIF()

The unittest.cmake script runs the test on the unit test executable
target, and if the test fails, it removes the unit test executable
and bails out with a FATAL_ERROR. In this manner, the failing unit
test's executable is relinked the next time Make is run, and the
custom command performing the test is also run again. OTOH, if the
test passes, its executable will not be touched during the next Make
run, and the attached custom command will not be invoked, so the test
is dropped - as the OP desires - until the test executable is rebuilt.

Try make pass to see a successful unit test, and make fail for a
failing one. You will see make pass building the pass executable
and performing the succeeding test; a subsequent make pass will do
nothing unless pass is rebuilt. A make fail, however, will always
build/relink and - unsuccessfully - perform its test; change fail.c to
return 0, and you will see make fail behave exactly like make pass.

Effectively, this means using the unit test executable as a stamp file,
but in fact, you're already doing the same in your suggestions: If the
test has passed once, your stamp files are never removed, so the only
criterion to trigger the test again is a renewed unit test executable.
IMO, attaching 

[Cmake-commits] CMake branch, master, updated. v2.8.5-452-ga0ec7a0

2011-09-13 Thread David Cole
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project CMake.

The branch, master has been updated
   via  a0ec7a00d5fe1a8b65329545f24080af581705be (commit)
   via  3a0d63242d959871b8f047e7f7ee1531f113f436 (commit)
   via  91704ef2dee3ad606a6cc0f1e03e6f254d211b8f (commit)
  from  c7021203de8a3632d7f33bc812b41e88f5bc86f9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a0ec7a00d5fe1a8b65329545f24080af581705be
commit a0ec7a00d5fe1a8b65329545f24080af581705be
Merge: c702120 3a0d632
Author: David Cole david.c...@kitware.com
AuthorDate: Tue Sep 13 14:32:52 2011 -0400
Commit: CMake Topic Stage kwro...@kitware.com
CommitDate: Tue Sep 13 14:32:52 2011 -0400

Merge topic 'add-kwstyle-test'

3a0d632 KWStyle Test: Activate by default if KWStyle is found
91704ef Tests: Add a KWStyle test, equivalent to the make StyleCheck target


---

Summary of changes:
 Tests/CMakeLists.txt |   13 +
 Utilities/KWStyle/CMakeLists.txt |   28 ++--
 2 files changed, 35 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
CMake
___
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits


[Cmake-commits] CMake branch, master, updated. v2.8.5-455-g0b29621

2011-09-13 Thread David Cole
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project CMake.

The branch, master has been updated
   via  0b29621e6c15ea04b67ea541fb02403b315a770a (commit)
   via  b7457de4eab41028a625887d27961a96120cfe1d (commit)
   via  59204e11265eee5f8a482cf52b5daf5d57ed85c7 (commit)
  from  a0ec7a00d5fe1a8b65329545f24080af581705be (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0b29621e6c15ea04b67ea541fb02403b315a770a
commit 0b29621e6c15ea04b67ea541fb02403b315a770a
Merge: a0ec7a0 b7457de
Author: David Cole david.c...@kitware.com
AuthorDate: Tue Sep 13 14:32:58 2011 -0400
Commit: CMake Topic Stage kwro...@kitware.com
CommitDate: Tue Sep 13 14:32:58 2011 -0400

Merge topic 'CPack-DocFix-bug12449'

b7457de CPack fix template too
59204e1 CPack fix #12449 doc mispelled


---

Summary of changes:
 Modules/CPack.cmake|2 +-
 Templates/CPackConfig.cmake.in |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake
___
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits


[Cmake-commits] CMake branch, master, updated. v2.8.5-460-g98d5623

2011-09-13 Thread David Cole
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project CMake.

The branch, master has been updated
   via  98d5623a7b809a8d730fd197412935b52f234e7d (commit)
   via  64c9b318bf6062aa1a451d15af9e7016057168c1 (commit)
   via  59a22655765a46c48dc3f45189101f2e9a265776 (commit)
  from  21e03c4c4431878c70afeefcf4f0271f5d8b16ed (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98d5623a7b809a8d730fd197412935b52f234e7d
commit 98d5623a7b809a8d730fd197412935b52f234e7d
Merge: 21e03c4 64c9b31
Author: David Cole david.c...@kitware.com
AuthorDate: Tue Sep 13 14:33:21 2011 -0400
Commit: CMake Topic Stage kwro...@kitware.com
CommitDate: Tue Sep 13 14:33:21 2011 -0400

Merge topic 'effective-platform-name'

64c9b31 Xcode: Add test to demonstrate iOS project in Xcode
59a2265 Xcode: Use EFFECTIVE_PLATFORM_NAME reference in ComputeOutputDir


---

Summary of changes:
 Source/cmTarget.cxx  |6 +-
 Tests/iOSNavApp/CMakeLists.txt   |   38 ++
 Tests/iOSNavApp/Classes/NavApp3AppDelegate.h |   20 +
 Tests/iOSNavApp/Classes/NavApp3AppDelegate.m |   88 +
 Tests/iOSNavApp/Classes/RootViewController.h |   14 +
 Tests/iOSNavApp/Classes/RootViewController.m |  168 
 Tests/iOSNavApp/Info.plist.in|   32 ++
 Tests/iOSNavApp/MainWindow.xib   |  542 ++
 Tests/iOSNavApp/NavApp3_Prefix.pch   |   14 +
 Tests/iOSNavApp/RootViewController.xib   |  384 ++
 Tests/iOSNavApp/TotalFunction.c  |   14 +
 Tests/iOSNavApp/TotalFunction.h  |   14 +
 Tests/iOSNavApp/main.m   |   17 +
 13 files changed, 1350 insertions(+), 1 deletions(-)
 create mode 100644 Tests/iOSNavApp/CMakeLists.txt
 create mode 100644 Tests/iOSNavApp/Classes/NavApp3AppDelegate.h
 create mode 100644 Tests/iOSNavApp/Classes/NavApp3AppDelegate.m
 create mode 100644 Tests/iOSNavApp/Classes/RootViewController.h
 create mode 100644 Tests/iOSNavApp/Classes/RootViewController.m
 create mode 100644 Tests/iOSNavApp/Info.plist.in
 create mode 100644 Tests/iOSNavApp/MainWindow.xib
 create mode 100644 Tests/iOSNavApp/NavApp3_Prefix.pch
 create mode 100644 Tests/iOSNavApp/RootViewController.xib
 create mode 100644 Tests/iOSNavApp/TotalFunction.c
 create mode 100644 Tests/iOSNavApp/TotalFunction.h
 create mode 100644 Tests/iOSNavApp/main.m


hooks/post-receive
-- 
CMake
___
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits