Re: [CMake] BUILD_COMMAND having a hard time getting usable command lines

2011-11-28 Thread J Decker
On Sun, Nov 27, 2011 at 8:30 AM, Michael Hertling  wrote:
> On 11/26/2011 07:14 PM, J Decker wrote:
>> Earlier I wondered if there was a way to stop recusive invocation of a
>> build command in a cmake script - I found something like a solution;
>> when I run the command, set an environment variable and don't run the
>> command if that environment variable is set... But...
>>
>> If I specify 'TARGET' in BUILD_COMMAND, then it gets extra quotes
>> around it, which make it impossible to pass to execute_process.  Also
>> why doesn't cmake-gui run certain commands?
>>
>> --example - probably incomplete ---
>>
>> PROJECT( whatever )
>>   build_command( GENERATOR_BUILD_COMMAND CONFIGURATION
>> ${CMAKE_BUILD_TYPE} PROJECT_NAME ${PROJECT_NAME} TARGET all )
>>   message( "build command:${GENERATOR_BUILD_COMMAND}" )
>>
>> - output  ---
>>
>> build command:e:/tools/unix/mingw/bin/mingw32-make.exe -i "all"
>> mingw32-make.exe: *** No rule to make target `"all"'.  Stop.
>
> What happens if you omit the TARGET clause in BUILD_COMMAND()?
> Target "all" should be the default when nothing is specified.

yes, but then how do I specify 'install' or 'package' targets?

>
>> ---end output, begin explanation
>>
>> In order to get BUILD_COMMAND output to work at all I have to
>>
>>     STRING( REPLACE "\ " ";" GENERATOR_BUILD_COMMAND
>> ${GENERATOR_BUILD_COMMAND} )
>
> AFAIK, that's exactly the job of SEPARATE_ARGUMENTS().

ahh excellent - read through the docs like 3 times and missed that

>
>> which replaces the spaces in the command with semicolons, so it looks
>> like seperate commands for
>>
>>       EXECUTE_PROCESS(COMMAND ${GENERATOR_BUILD_COMMAND}
>> WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
>>
>>  and in cmake-gui the output looks something like
>>
>> ---
>> build command:e:/tools/unix/mingw/bin/mingw32-make.exe -i "all"
>> Executing command... (output just before Execute_process)
>> Configuring done
>> ---
>>   but the command is never actually executed?  I go out to a command
>> line and type cmake . and the build goes.
>
> I can confirm this, but if I understand correctly, you are trying
> to build the project while it still undergoes its configuration, in
> particular before the generation step has finished. If so, wouldn't
> you expect quite strange behaviors? Could you provide a small and
> self-contained example which demonstrates what you intend to do?

Uhmm I'll work on that - what I have works, except not in the gui
works fine to type cmake . - which generates as the first thing in the
makefiles anyway.Had to use environment variables to lockout
re-executing the build.

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

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] How to set build configuration when using CDash test scheduling?

2011-11-28 Thread Nils Gladitz
I'm using CDash's (1.8.2) test scheduling and have trouble with a few 
tests added with the newer "add_test(NAME ..." signature.
Tests added with the new signature are "Not Run" and I get the following 
test output:


Test not available without configuration. (Missing "-C "?)

On a client machine ctest (2.8.6 on windows with Visual Studio 2010) 
runs in script mode polling for new test jobs from my CDash instance; 
jobs are run with different configurations.
The build configuration gets picked up properly by the build (I assume 
"ctest_build" - I can see files in the Debug/Release output directory as 
configured via CDash).


What do I have to do so the test command (I assume) "ctest_test" picks 
this up as well?


I use the preconfigured client script with an additional 
"ctest_empty_binary_directory" before the initial cache gets written:


# From this line down, this script may be customized
# on the Clients tab of the CDash createProject page.
#
if(JOB_MODULE)
  set(SOURCE_NAME ${JOB_MODULE})
  if(JOB_TAG)
set(SOURCE_NAME ${SOURCE_NAME}-${JOB_TAG})
  endif()
else()
  set(SOURCE_NAME ${PROJECT_NAME})
  if(JOB_BUILDNAME_SUFFIX)
set(SOURCE_NAME ${SOURCE_NAME}-${JOB_BUILDNAME_SUFFIX})
  endif()
endif()

set(CTEST_SOURCE_NAME ${SOURCE_NAME})
set(CTEST_BINARY_NAME ${SOURCE_NAME}-bin)
set(CTEST_DASHBOARD_ROOT "${CLIENT_BASE_DIRECTORY}")
set(CTEST_SOURCE_DIRECTORY 
"${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
set(CTEST_BINARY_DIRECTORY 
"${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")

set(CTEST_CMAKE_GENERATOR "${JOB_CMAKE_GENERATOR}")
set(CTEST_BUILD_CONFIGURATION "${JOB_BUILD_CONFIGURATION}")

set(CTEST_SITE "${CLIENT_SITE}")
set(CTEST_BUILD_NAME 
"${JOB_OS_NAME}-${JOB_OS_VERSION}-${JOB_OS_BITS}-${JOB_COMPILER_NAME}-${JOB_COMPILER_VERSION}")

if(JOB_BUILDNAME_SUFFIX)
  set(CTEST_BUILD_NAME ${CTEST_BUILD_NAME}-${JOB_BUILDNAME_SUFFIX})
endif()

if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
  set(CTEST_CHECKOUT_COMMAND "svn co ${JOB_REPOSITORY} ${SOURCE_NAME}")
endif()
set(CTEST_UPDATE_COMMAND "svn")

ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")

file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" 
"${JOB_INITIAL_CACHE}")


ctest_start(${JOB_BUILDTYPE})
ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
# The following lines are used to associate a build id with this job.
set(CTEST_DROP_SITE ${JOB_DROP_SITE})
set(CTEST_DROP_LOCATION ${JOB_DROP_LOCATION})
ctest_submit(RETURN_VALUE res)

message("DONE")

Thanks in advance
Nils
--

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] BUILD_COMMAND having a hard time getting usable command lines

2011-11-28 Thread David Cole
On Mon, Nov 28, 2011 at 5:05 AM, J Decker  wrote:
> On Sun, Nov 27, 2011 at 8:30 AM, Michael Hertling  wrote:
>> On 11/26/2011 07:14 PM, J Decker wrote:
>>> Earlier I wondered if there was a way to stop recusive invocation of a
>>> build command in a cmake script - I found something like a solution;
>>> when I run the command, set an environment variable and don't run the
>>> command if that environment variable is set... But...
>>>
>>> If I specify 'TARGET' in BUILD_COMMAND, then it gets extra quotes
>>> around it, which make it impossible to pass to execute_process.  Also
>>> why doesn't cmake-gui run certain commands?
>>>
>>> --example - probably incomplete ---
>>>
>>> PROJECT( whatever )
>>>   build_command( GENERATOR_BUILD_COMMAND CONFIGURATION
>>> ${CMAKE_BUILD_TYPE} PROJECT_NAME ${PROJECT_NAME} TARGET all )
>>>   message( "build command:${GENERATOR_BUILD_COMMAND}" )
>>>
>>> - output  ---
>>>
>>> build command:e:/tools/unix/mingw/bin/mingw32-make.exe -i "all"
>>> mingw32-make.exe: *** No rule to make target `"all"'.  Stop.
>>
>> What happens if you omit the TARGET clause in BUILD_COMMAND()?
>> Target "all" should be the default when nothing is specified.
>
> yes, but then how do I specify 'install' or 'package' targets?
>
>>
>>> ---end output, begin explanation
>>>
>>> In order to get BUILD_COMMAND output to work at all I have to
>>>
>>>     STRING( REPLACE "\ " ";" GENERATOR_BUILD_COMMAND
>>> ${GENERATOR_BUILD_COMMAND} )
>>
>> AFAIK, that's exactly the job of SEPARATE_ARGUMENTS().
>
> ahh excellent - read through the docs like 3 times and missed that
>
>>
>>> which replaces the spaces in the command with semicolons, so it looks
>>> like seperate commands for
>>>
>>>       EXECUTE_PROCESS(COMMAND ${GENERATOR_BUILD_COMMAND}
>>> WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
>>>
>>>  and in cmake-gui the output looks something like
>>>
>>> ---
>>> build command:e:/tools/unix/mingw/bin/mingw32-make.exe -i "all"
>>> Executing command... (output just before Execute_process)
>>> Configuring done
>>> ---
>>>   but the command is never actually executed?  I go out to a command
>>> line and type cmake . and the build goes.
>>
>> I can confirm this, but if I understand correctly, you are trying
>> to build the project while it still undergoes its configuration, in
>> particular before the generation step has finished. If so, wouldn't
>> you expect quite strange behaviors? Could you provide a small and
>> self-contained example which demonstrates what you intend to do?
>
> Uhmm I'll work on that - what I have works, except not in the gui
> works fine to type cmake . - which generates as the first thing in the
> makefiles anyway.    Had to use environment variables to lockout
> re-executing the build.
>
>>
>> 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
>>
> --
>
> 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
>

This is a completely unexpected way of using CMake. (From us CMake
developers' perspectives...)

I would not rely on this remaining working in the future.

Configure first, and then build as a separate step. Or use
ExternalProject. Or use a cmake -P script to call "cmake ." for
configuring first, and then "cmake --build ." to build.

Trying to build the project from the configure step is asking for
trouble, if you ask me


2 cents,
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] How to set build configuration when using CDash test scheduling?

2011-11-28 Thread David Cole
If you're using 2.8.6 (you said you were, right?) ... do this:

  set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")

instead of this:

  set(CTEST_BUILD_CONFIGURATION "${JOB_BUILD_CONFIGURATION}")

Setting both will not hurt, but if both are set,
CTEST_CONFIGURATION_TYPE is used, and not CTEST_BUILD_CONFIGURATION.
Adding that variable was part of the bug fix for
http://public.kitware.com/Bug/view.php?id=2336, which was fixed back
in December, 2009...


HTH,
David


On Mon, Nov 28, 2011 at 6:30 AM, Nils Gladitz  wrote:
> I'm using CDash's (1.8.2) test scheduling and have trouble with a few tests
> added with the newer "add_test(NAME ..." signature.
> Tests added with the new signature are "Not Run" and I get the following
> test output:
>
>    Test not available without configuration. (Missing "-C "?)
>
> On a client machine ctest (2.8.6 on windows with Visual Studio 2010) runs in
> script mode polling for new test jobs from my CDash instance; jobs are run
> with different configurations.
> The build configuration gets picked up properly by the build (I assume
> "ctest_build" - I can see files in the Debug/Release output directory as
> configured via CDash).
>
> What do I have to do so the test command (I assume) "ctest_test" picks this
> up as well?
>
> I use the preconfigured client script with an additional
> "ctest_empty_binary_directory" before the initial cache gets written:
>
>    # From this line down, this script may be customized
>    # on the Clients tab of the CDash createProject page.
>    #
>    if(JOB_MODULE)
>      set(SOURCE_NAME ${JOB_MODULE})
>      if(JOB_TAG)
>        set(SOURCE_NAME ${SOURCE_NAME}-${JOB_TAG})
>      endif()
>    else()
>      set(SOURCE_NAME ${PROJECT_NAME})
>      if(JOB_BUILDNAME_SUFFIX)
>        set(SOURCE_NAME ${SOURCE_NAME}-${JOB_BUILDNAME_SUFFIX})
>      endif()
>    endif()
>
>    set(CTEST_SOURCE_NAME ${SOURCE_NAME})
>    set(CTEST_BINARY_NAME ${SOURCE_NAME}-bin)
>    set(CTEST_DASHBOARD_ROOT "${CLIENT_BASE_DIRECTORY}")
>    set(CTEST_SOURCE_DIRECTORY
> "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
>    set(CTEST_BINARY_DIRECTORY
> "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
>    set(CTEST_CMAKE_GENERATOR "${JOB_CMAKE_GENERATOR}")
>    set(CTEST_BUILD_CONFIGURATION "${JOB_BUILD_CONFIGURATION}")
>
>    set(CTEST_SITE "${CLIENT_SITE}")
>    set(CTEST_BUILD_NAME
> "${JOB_OS_NAME}-${JOB_OS_VERSION}-${JOB_OS_BITS}-${JOB_COMPILER_NAME}-${JOB_COMPILER_VERSION}")
>    if(JOB_BUILDNAME_SUFFIX)
>      set(CTEST_BUILD_NAME ${CTEST_BUILD_NAME}-${JOB_BUILDNAME_SUFFIX})
>    endif()
>
>    if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
>      set(CTEST_CHECKOUT_COMMAND "svn co ${JOB_REPOSITORY} ${SOURCE_NAME}")
>    endif()
>    set(CTEST_UPDATE_COMMAND "svn")
>
>    ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")
>
>    file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt"
> "${JOB_INITIAL_CACHE}")
>
>    ctest_start(${JOB_BUILDTYPE})
>    ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})
>    ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
>    ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
>    ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
>    # The following lines are used to associate a build id with this job.
>    set(CTEST_DROP_SITE ${JOB_DROP_SITE})
>    set(CTEST_DROP_LOCATION ${JOB_DROP_LOCATION})
>    ctest_submit(RETURN_VALUE res)
>
>    message("DONE")
>
> Thanks in advance
> Nils
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--

Powered by www.kitware.com

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

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

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


Re: [CMake] How to set build configuration when using CDash test scheduling?

2011-11-28 Thread Nils Gladitz

Yes, thank you, that fixed it.

Maybe this should be updated in the default template generated by CDash(?).

Nils
--

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] VS2005 and cmake

2011-11-28 Thread Tom Deblauwe

Hello,

I've found why it was not working: you just need to manually load the 
macro with "load macro project" and then you need to find the 
CMakeVSMacros2.vcmacros file and load it. You find the file in the 
install dir of cmake e.g. under "share/cmake-2.8/Templates". Then 
everything works without the reload dialogs.


Best regards,
Tom,

Op 25/11/2011 16:12, John Drescher schreef:

On Fri, Nov 25, 2011 at 3:55 AM, Tom Deblauwe  wrote:

Hello,

Are you sure that is not some kind of extension or plugin that you are
using?
I don't think you can reload all the projects at once in VS2005?
Best regards,
Tom,


CMake installs a visual studio macro that handles this. When there is
a large change the macro should pop up in the GUI asking you ( I
believe) if you want to continue building or cancel. In either case it
should reload all projects. In the 3 to 4 years I have used CMake with
visual studio (2005 and 2008) I have sometimes seen this fail and
Visual Studio would prompt for reloading.

John


--
*Tom Deblauwe*
*R&D Engineer*

Traficon International N.V.
Vlamingstraat 19
B-8560 Wevelgem
Belgium
Tel.: +32 (0)56 37.22.00
Fax: +32 (0)56 37.21.96
URL: www.traficon.com 
--

Powered by www.kitware.com

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

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

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

Re: [CMake] How to set build configuration when using CDash test scheduling?

2011-11-28 Thread David Cole
On Mon, Nov 28, 2011 at 9:15 AM, Nils Gladitz  wrote:
> Yes, thank you, that fixed it.
>
> Maybe this should be updated in the default template generated by CDash(?).
>
> Nils
>


Yes, it should. :-)
--

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] Finding PythonLibs using PythonInterp

2011-11-28 Thread Felipe Lema
Hello, everyone

I was trying to use cmake to build python c++ extensions in win7, but
couldn't get cmake to detect PythonLibs. At least, not without editing the
windows registry. Since it could detect PythonInterp, I got it working
using the directories provided from methods inside the interpreter.

-- code snippet --
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys;from
distutils.sysconfig import
get_python_inc;sys.stdout.write(get_python_inc())"
OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS
ERROR_VARIABLE ERROR_FINDING_INCLUDES)

execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys;from
numpy.distutils.numpy_distribution import NumpyDistribution;from
numpy.distutils.command.build_ext import
build_ext;a=build_ext(NumpyDistribution());a.ensure_finalized();sys.stdout.write(';'.join(a.library_dirs))"
OUTPUT_VARIABLE PYTHON_LIBRARIES_DIR
ERROR_VARIABLE ERROR_FINDING_LIBRARIES)

  -- /code snippet --

These directories can be used later for finding the python .lib files and
version number, as cmake currently does (although using the directories
from the windows registry)

The only setback (at least for finding the python lib files) is that the
user must have numpy correctly installed with the found interpreter.
Haven't tried it, but there should be a way to get it to work without numpy
installed.

In spite of the latest, I still think that this code is very useful.

PS=Just in case, the python script embedded in the execute_process args
should be a single line
-- 

Felipe Lema Salas
Ingeniero Civil en Computación
Laboratorio ALGES
Departamento de Ingeniería en Minas
Universidad de Chile
--

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 with cminpack, link libraries

2011-11-28 Thread Fabian Torres
Thanks a lot for the information. I would check the documentation and continue 
working on this.

thanks again. 
--

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] How to build for 32bit using multiarch?

2011-11-28 Thread Kishore Jonnalagadda
I have recently moved to using 64bit Kubuntu Oneiric when supports
multiarch. I understand that building 32 bit from my 64 install is as
simple as adding the "-m32" option to gcc. Asking cmake to add that
flag is easy but i don't know how to ask cmake to only look for 32 bit
libraries in FindPackage() class. I have all the 32bit library (Qt)
dependencies installed and they are in /usr/lib/i386-linux-gnu. By
adding the "-m32" option compilation succeeds but as expected linking
fails complaining that i am trying to link to 64 bit libraries.

So, how do i ask cmake to look for 32bit libs?
--
Cheers!
Kishore

Ps: Is this "multiarch" unique to *ubuntu or all distributions adopting it?
--

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] BUILD_COMMAND having a hard time getting usable command lines

2011-11-28 Thread J Decker
So the idea was, to make the build process a single click (or couple)
or at least a single application to build.  Since CMake knows how to
build a project, it became easier to maintain a cmakelists.txt which
does the build than a batch file...

So my top most level project now is a series of targets which do a
build and an install and possibly additional commands between each
target.  (Some project have deploy commands that build other scripts
that get used later in the build).

By adding some options to do the build command at the end of the
script (especially if those options default as off) I figured I could
trigger a build.

Yes; If I do 'cmake -G 'SomeGenerator' -DGENERATOR_BUILD_ALL_NOW=1'
then in a clean directory, this fails to actually to the build,
repeating this command allows the project build to commence.

If I don't use the command line with the custom knowledge that things
exist in a cmakelists; and I use 'cmake-gui' then point it at the
sources, click 'configure' and the options are read, and hmm I guess I
could still just configure and not generate and set the build now
option; then the build can happen automatically from just knowing
cmake, not the environment specific mingw32-make.exe or wmake or
devenv or whatever
--

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] Documentation does not include --check-build-system

2011-11-28 Thread Alexander Neundorf
On Saturday 26 November 2011, J Decker wrote:
> I don't find any documentation on the command that cmake uses with a
> cmake -E --check-build-system  Does this option happen to set any
> specific cmake variable indicating that it is doing a check build?
> 
> I'm inquiring and I saw a post about it before
> http://www.kwwidgets.org/Bug/view.php?id=2133   (closed)
> 
> about someone saying it might be nice to be able to bypass the
> cmake_check_build_system rule in the makefile.
> 
> I would like to make building this project a single click interface.
> - in the cmake script I can define some options to build all, install
> or package during the configure.  But if I do, then the first thing
> that is done is the cmake script is processed again (which it already
> was), which triggers the make again, which calls cmake, etc.  I could
> test to see if's a phase that isn't --check-build-system and do the
> command?
> 
> Also I think I'd really just like to be the last thing done on a
> 'generate' in the cmake-gui (not entirely sure what the difference is
> between configure and generate).

"Configure" basically processes the CMakeLists.txt, "Generate" then generates 
the Makefiles/project files.

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


[CMake] 2D arrays

2011-11-28 Thread Robert Dailey
Is it possible to have 2D arrays in CMake? As far as the core syntax is
concerned, it seems like only 1D arrays are supported. So far I've had to
work around this issue by using a flat array and skipping over elements
using foreach() with a range and step.

Any ideas? Thanks.

-
Robert Dailey
--

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] Finding PythonLibs using PythonInterp

2011-11-28 Thread Michael Hertling
On 11/28/2011 03:54 PM, Felipe Lema wrote:
> Hello, everyone
> 
> I was trying to use cmake to build python c++ extensions in win7, but
> couldn't get cmake to detect PythonLibs. At least, not without editing the
> windows registry. Since it could detect PythonInterp, I got it working
> using the directories provided from methods inside the interpreter.
> 
> -- code snippet --
> execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys;from
> distutils.sysconfig import
> get_python_inc;sys.stdout.write(get_python_inc())"
> OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS
> ERROR_VARIABLE ERROR_FINDING_INCLUDES)
> 
> execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys;from
> numpy.distutils.numpy_distribution import NumpyDistribution;from
> numpy.distutils.command.build_ext import
> build_ext;a=build_ext(NumpyDistribution());a.ensure_finalized();sys.stdout.write(';'.join(a.library_dirs))"
> OUTPUT_VARIABLE PYTHON_LIBRARIES_DIR
> ERROR_VARIABLE ERROR_FINDING_LIBRARIES)
> 
>   -- /code snippet --
> 
> These directories can be used later for finding the python .lib files and
> version number, as cmake currently does (although using the directories
> from the windows registry)
> 
> The only setback (at least for finding the python lib files) is that the
> user must have numpy correctly installed with the found interpreter.
> Haven't tried it, but there should be a way to get it to work without numpy
> installed.
> 
> In spite of the latest, I still think that this code is very useful.
> 
> PS=Just in case, the python script embedded in the execute_process args
> should be a single line

The main drawback of your approach is that one has to invoke the Python
interpreter which is probably not acceptable in certain cross-compiling
scenarios. There've been several discussions about improvements of the
FindPython*.cmake modules, see [1,2], and the consensus is, IIRC, that
there should be one comprehensive and component-aware FindPython.cmake
module, knowing at least the components "interpreter" and "libraries"
and ensuring that both are consistent w.r.t. their version. Moreover,
the said module should allow the user to specify the desired version
via FIND_PACKAGE()'s respective interface, but the prevalent obstacle
in this regard is the FIND_*() commands' current inability to look for
patterns, e.g. FIND_PROGRAM() cannot search for "python[0-9]+\.[0-9]+".
IMO, addressing these issues should be preferred to pouring resources
into those rather outmoded FindPython{Interp,Libs}.cmake find modules.

Regards,

Michael

[1] http://www.mail-archive.com/cmake@cmake.org/msg30086.html
[2] http://www.mail-archive.com/cmake@cmake.org/msg29487.html
--

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] Capturing matches in regex groups

2011-11-28 Thread Robert Dailey
I haven't really seen a way to get a list of group matches in a regex. For
example, string( REGEX MATCH ) only returns the whole string matched, not
just what was in the capture groups. If I do this:

(\\w+)\\,(\\w+)\\,(\\w+)

and I match that regex against this string:

hello,world,today

I should get a list with:

hello;world;today

How can I do this?

-
Robert Dailey
--

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] Documentation does not include --check-build-system

2011-11-28 Thread J Decker
On Mon, Nov 28, 2011 at 12:01 PM, Alexander Neundorf
 wrote:
> On Saturday 26 November 2011, J Decker wrote:
>> I don't find any documentation on the command that cmake uses with a
>> cmake -E --check-build-system  Does this option happen to set any
>> specific cmake variable indicating that it is doing a check build?
>>
>> I'm inquiring and I saw a post about it before
>> http://www.kwwidgets.org/Bug/view.php?id=2133   (closed)
>>
>> about someone saying it might be nice to be able to bypass the
>> cmake_check_build_system rule in the makefile.
>>
>> I would like to make building this project a single click interface.
>> - in the cmake script I can define some options to build all, install
>> or package during the configure.  But if I do, then the first thing
>> that is done is the cmake script is processed again (which it already
>> was), which triggers the make again, which calls cmake, etc.  I could
>> test to see if's a phase that isn't --check-build-system and do the
>> command?
>>
>> Also I think I'd really just like to be the last thing done on a
>> 'generate' in the cmake-gui (not entirely sure what the difference is
>> between configure and generate).
>
> "Configure" basically processes the CMakeLists.txt, "Generate" then generates
> the Makefiles/project files.
>

Right; but there's apparently no way for a script to know if it is
being configured or generated?  - or build-checked?

> 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] BUILD_COMMAND having a hard time getting usable command lines

2011-11-28 Thread Michael Hertling
On 11/28/2011 08:43 PM, J Decker wrote:
> So the idea was, to make the build process a single click (or couple)
> or at least a single application to build.  Since CMake knows how to
> build a project, it became easier to maintain a cmakelists.txt which
> does the build than a batch file...
> 
> So my top most level project now is a series of targets which do a
> build and an install and possibly additional commands between each
> target.  (Some project have deploy commands that build other scripts
> that get used later in the build).
> 
> By adding some options to do the build command at the end of the
> script (especially if those options default as off) I figured I could
> trigger a build.
> 
> Yes; If I do 'cmake -G 'SomeGenerator' -DGENERATOR_BUILD_ALL_NOW=1'
> then in a clean directory, this fails to actually to the build,
> repeating this command allows the project build to commence.
> 
> If I don't use the command line with the custom knowledge that things
> exist in a cmakelists; and I use 'cmake-gui' then point it at the
> sources, click 'configure' and the options are read, and hmm I guess I
> could still just configure and not generate and set the build now
> option; then the build can happen automatically from just knowing
> cmake, not the environment specific mingw32-make.exe or wmake or
> devenv or whatever

(1) Build the following project from the VS command prompt:

# CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(BUILD C)
ADD_EXECUTABLE(main main.c)
SET_TARGET_PROPERTIES(main PROPERTIES
COMPILE_DEFINITIONS NUMBER=1)

/* main.c: */
#include 
int main(void)
{
printf("%d\n",NUMBER); return 0;
}

Now, set NUMBER to 2 in the CMakeLists.txt file and rebuild with
"cmake --build", so in the end, you do the same as the command line
returned by BUILD_COMMAND() would do. You'll see that the project is
reconfigured but not rebuilt although the modified COMPILE_DEFINITIONS
effect the executable. That's because a touched .vcproj file obviously
doesn't have VC rebuild the associated targets. Of course, this isn't
caused by your building-while-configuring approach, but the latter
makes it harder to account for inconveniences of that kind.

(2) Configure the following project from the CMake GUI:

# CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(THREETIMES C)
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n")
ADD_EXECUTABLE(main main.c)
OPTION(OPTION_X "Option X" OFF)
IF(OPTION_X)
OPTION(OPTION_Y "Option Y" OFF)
ENDIF()
IF(OPTION_Y)
OPTION(OPTION_Z "Option Z" OFF)
ENDIF()

After the second run, when there are no more red entries in the cache
window, check the OPTION_X box, reconfigure and the OPTION_Y box will
appear. Check it and reconfigure to see the OPTION_Z box. In order to
enable OPTION_{X,Y,Z}, you have to reconfigure three times, see [1,2]
for more information. In general, you must be prepared to reconfigure
an arbitrary number of times till you reach the desired configuration.
You would definitely not want to rebuild the project each time.

(3) It's even possible to cause a, say, configuration loop:

# CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(LOOP C)
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n")
ADD_EXECUTABLE(main main.c)
OPTION(LOOP "Option LOOP" OFF)
IF(LOOP)
UNSET(LOOP CACHE)
ELSE()
SET(LOOP ON CACHE BOOL "Option LOOP" FORCE)
ENDIF()

Configure the project multiple times from the CMake GUI and you will
see that the cache doesn't stabilize; instead, it oscillates between
two states. Of course, this example is pathological but proves that
the cache might generally traverse a cycle of states - one step per
reconfiguration - and only the user can know which state is the
desired one. You would definitely not want... see above.

The essence is: Even if your approach worked from within the CMake GUI,
it might have serious conceptional drawbacks, depending on the project,
so you should heed David's counsel and simply not pursue it, IMO.

Regards,

Michael

[1] http://www.cmake.org/cmake/help/runningcmake.html
[2] http://www.mail-archive.com/cmake@cmake.org/msg31287.html
--

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] Capturing matches in regex groups

2011-11-28 Thread Michael Hertling
On 11/28/2011 11:35 PM, Robert Dailey wrote:
> I haven't really seen a way to get a list of group matches in a regex. For
> example, string( REGEX MATCH ) only returns the whole string matched, not
> just what was in the capture groups. If I do this:
> 
> (\\w+)\\,(\\w+)\\,(\\w+)
> 
> and I match that regex against this string:
> 
> hello,world,today
> 
> I should get a list with:
> 
> hello;world;today
> 
> How can I do this?

CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(REGEXREPLACE NONE)
STRING(REGEX REPLACE
"([A-Za-z0-9_]+),([A-Za-z0-9_]+),([A-Za-z0-9_]+)"
"\\1;\\2;\\3" RESULT "hello,world,today")
LIST(LENGTH RESULT n)
MESSAGE("n=${n}")
FOREACH(i IN LISTS RESULT)
MESSAGE("${i}")
ENDFOREACH()

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


Re: [CMake] CTestScript for all available git branches/tags

2011-11-28 Thread norulez
Is the CMake mailing list dead?

Best Regards

Am 24.11.2011 um 15:45 schrieb "NoRulez" :

> So, nobody an idea?
> 
> Do I only have to add an foreach loop like in the following example or is
> there more to do:
> 
> #get all branches/tags into GIT_BRANCHES/GIT_TAGS
> 
> FOREACH(GIT_BRANCH ${GIT_BRANCHES})
>execute_process (COMMAND ${GIT_EXECUTABLE} checkout ${GIT_BRANCH}
> WORKING_DIRECTORY ${CTEST_SOURCE_DIRECTORY})
>ctest_start (${MODEL} TRACK ${MODEL})
>ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE
> NUMBER_FILES)
>ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}")
>ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}")
>ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}")
>ctest_coverage ()
>ctest_memcheck ()
>ctest_submit ()
> ENDFOREACH()
> 
> FOREACH(GIT_TAG ${GIT_TAGS})
>execute_process (COMMAND ${GIT_EXECUTABLE} checkout -b ${GIT_TAG}
> WORKING_DIRECTORY ${CTEST_SOURCE_DIRECTORY})
>ctest_start (${MODEL} TRACK ${MODEL})
>ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE
> NUMBER_FILES)
>ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}")
>ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}")
>ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}")
>ctest_coverage ()
>ctest_memcheck ()
>ctest_submit ()
> ENDFOREACH()
> 
> Thanks in advance
> 
> Best Regards
> NoRulez
> 
> -Ursprüngliche Nachricht-
> Von: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] Im Auftrag
> von
> noru...@me.com
> Gesendet: Sonntag, 20. November 2011 18:21
> An: CMake MailingList
> Betreff: [CMake] CTestScript for all available git branches/tags
> 
> Hi,
> 
> if I have two or more projects (let's say proj1 and proj2) and for the
> proj1 i've the branches v1.0 and v1.1. For proj2 i've the branches v1.0,
> v1.1 and the tag v1.3 for example.
> 
> Currently CTest runs in Continuous and Nightly mode for the master branch.
> But I want to run those modes for every branch/tag for each project. So
> for
> e.g.:
> 
> proj1/master
> proj1/v1.0
> proj1/v1.1
> 
> proj2/master
> proj2/v1.0
> proj2/v1.1
> proj2/v1.3
> 
> How can I do that?
> 
> Many thanks in advance
> 
> Best Regards
> NoRulez
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> 
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
--

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