Re: [CMake] CTest outside of CMake

2011-10-17 Thread Eric Noulard
2011/10/17 Tim Gallagher :
> Hi,
>
> We have our project set up to run a series of test cases, but we are treating 
> it as if we are not using CMake. I found a tutorial online on how to set it 
> up, and we have it running just fine when we want to run all of the tests. 
> But, I haven't figured out how to do the configure/build steps for selected 
> tests only.
>
> For example, each test has it's own configure command and build command. If I 
> do
>
> ctest -I 2,2
>
> then it configures and builds all the tests, but will only run the second 
> test.
>
> The driver script contains a section like:
>
> foreach(TESTCASE ${LESLIE_AVAILABLE_TESTCASES})
>  set(CTEST_CONFIGURE_COMMAND "./setup.py -t ${TESTCASE} 
> ${LESLIE_CONFIGURE_DICT}")
>  ctest_configure(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
>  set(CTEST_BUILD_COMMAND "./setup.py -t ${TESTCASE} ${LESLIE_BUILD_DICT}")
>  ctest_build(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
> endforeach()
>
> and the LESLIE_AVAILABLE_TESTCASES is a list of test cases names that match 
> the add_test() test names. Is it possible when running CTest with -I or -R 
> (or even without -I or -R) to figure out which tests it selects so we can 
> build LESLIE_AVAILABLE_TESTCASES from that?

I'm not sure to understand your whole testing process flow,
Is the script above part of a ctest -S script?

Filtering some tests may be done with test NAMES or LABELS
see EXCLUDE / INCLUDE or
EXCLUDE_LABEL / INCLUDE_LABEL
 arguments of ctest_test (ctest --help-command ctest_test)

However you does not seem to use ctest_test ?
How do you run your ctest command (which arguments/options are you using)?

Concerning labels
see http://www.kitware.com/blog/home/post/11 and reference therein.



-- 
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] FindLAPACK in git head

2011-10-17 Thread Rolf Eike Beer
> Hi,
>
> We're having problems with FindLAPACK in the latest source head. It claims
> it cannot find LAPACK when previous versions of CMake find it just fine.
> It does not work with either the Generic version or the Intel version.
> FindBLAS correctly locates the library though.

No idea so far.

> And when we put in the path for the LAPACK_mkl_lapack_LIBRARY variable, it
> doesn't complain. But then during linking, we get:
>
> /opt/intel/Compiler/11.1/072/lib/intel64/libguide.so: undefined reference
> to `pthread_atfork'
> make[2]: *** [derivative/unitTests/utDerivativeTestc] Error 1
>
> even though libpthread.so exists and is on the library path in /usr/lib.

That means that you need to link against the pthread library. The problem
here is not that the library is not found, but that you did not tell CMake
to use it. Usually this is done by the LAPACK module, so the main reason
you are seeing this at all is that it did not find your library in the
first place.

Eike

Eike
--

Powered by www.kitware.com

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

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

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


Re: [CMake] How to define custom import library name (MSVC)?

2011-10-17 Thread Michael Hertling
On 10/16/2011 06:27 PM, zex spectrum wrote:
> Hello,
> 
> I generate a shared library named, for example, mylib80.dll (it has
> postfix "80", because I want to embed version info into library name.
> I use set_target_properties with _POSTFIX property to achieve
> this. By default, CMake names corresponding import library as
> mylib80.lib. But I want my shared lib to have an import lib named
> mylib.lib (without version embedded into its name). Is it possible at
> all? I tried IMPORT_SUFFIX, but it seems to not work as I expect.

AFAIK, a shared library target's import library is named like

... + ARCHIVE_OUTPUT_NAME_ + _POSTFIX + IMPORT_SUFFIX

so you cannot use the IMPORT_SUFFIX to overwrite the _POSTFIX.

> I use MSVC, I do not need to have this for GCC and other compilers.
> 
> Any help would be appreciated.

You might use an additional INSTALL(CODE ...) step, see the attached
CMakeLists.txt file. Note that the LOCATION property might have side
effects, cf. [1], so it's probably best to place it at the very end.

'hope that helps.

Regards,

Michael

[1] http://public.kitware.com/Bug/view.php?id=11671
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(IMPLIB C)
SET(CMAKE_VERBOSE_MAKEFILE ON)
FILE(WRITE ${CMAKE_BINARY_DIR}/f.c
"__declspec(dllexport) void f(void){}\n")
ADD_LIBRARY(f SHARED f.c)
SET_TARGET_PROPERTIES(f PROPERTIES DEBUG_POSTFIX "80")
INSTALL(TARGETS f RUNTIME DESTINATION bin ARCHIVE DESTINATION lib)
GET_TARGET_PROPERTY(F0 f LOCATION_DEBUG)
GET_FILENAME_COMPONENT(F0 "${F0}" NAME_WE)
STRING(REGEX REPLACE "80\$" "" F "${F0}")
INSTALL(CODE "FILE(RENAME \"${CMAKE_INSTALL_PREFIX}/lib/${F0}.lib\" 
\"${CMAKE_INSTALL_PREFIX}/lib/${F}.lib\")")
--

Powered by www.kitware.com

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

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

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

Re: [CMake] How to define custom import library name (MSVC)?

2011-10-17 Thread Michael Hertling
On 10/17/2011 01:58 PM, Michael Hertling wrote:
> On 10/16/2011 06:27 PM, zex spectrum wrote:
>> Hello,
>>
>> I generate a shared library named, for example, mylib80.dll (it has
>> postfix "80", because I want to embed version info into library name.
>> I use set_target_properties with _POSTFIX property to achieve
>> this. By default, CMake names corresponding import library as
>> mylib80.lib. But I want my shared lib to have an import lib named
>> mylib.lib (without version embedded into its name). Is it possible at
>> all? I tried IMPORT_SUFFIX, but it seems to not work as I expect.
> 
> AFAIK, a shared library target's import library is named like
> 
> ... + ARCHIVE_OUTPUT_NAME_ + _POSTFIX + IMPORT_SUFFIX
> 
> so you cannot use the IMPORT_SUFFIX to overwrite the _POSTFIX.
> 
>> I use MSVC, I do not need to have this for GCC and other compilers.
>>
>> Any help would be appreciated.
> 
> You might use an additional INSTALL(CODE ...) step, see the attached
> CMakeLists.txt file. Note that the LOCATION property might have side
> effects, cf. [1], so it's probably best to place it at the very end.
> 
> 'hope that helps.
> 
> Regards,
> 
> Michael
> 
> [1] http://public.kitware.com/Bug/view.php?id=11671

Addendum: If you want to be independent of the import library's actual
suffix, you might use INSTALL(SCRIPT ...) instead of INSTALL(CODE ...)
with the import library installed temporarily under CMAKE_BINARY_DIR:

# CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(IMPLIB C)
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(SRCDIR "${CMAKE_BINARY_DIR}/fimplib")
SET(DSTDIR "${CMAKE_INSTALL_PREFIX}/lib")
CONFIGURE_FILE(
"${CMAKE_SOURCE_DIR}/install_implib.cmake.in"
"${CMAKE_BINARY_DIR}/install_implib.cmake"
@ONLY)
FILE(WRITE ${CMAKE_BINARY_DIR}/f.c
"__declspec(dllexport) void f(void){}\n")
ADD_LIBRARY(f SHARED f.c)
SET_TARGET_PROPERTIES(f PROPERTIES
DEBUG_POSTFIX "80"
IMPORT_SUFFIX ".imp")  # <-- for demonstration.
INSTALL(TARGETS f
RUNTIME DESTINATION bin
ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/fimplib)
INSTALL(SCRIPT "${CMAKE_BINARY_DIR}/install_implib.cmake")

# install_implib.cmake.in:
FILE(GLOB F "@SRCDIR@/*")
GET_FILENAME_COMPONENT(F_EXT "${F}" EXT)
GET_FILENAME_COMPONENT(F_NWE "${F}" NAME_WE)
STRING(REGEX REPLACE "80\$" "" F_NWE "${F_NWE}")
FILE(RENAME "${F}" "@SRCDIR@/${F_NWE}${F_EXT}")
FILE(INSTALL "@SRCDIR@/${F_NWE}${F_EXT}"
DESTINATION "@DSTDIR@"
USE_SOURCE_PERMISSIONS)

AFAICS, the intermediate installation of the import library is necessary
to separate the latter from the DLL part, so one has a chance to rename
it without knowing its actual suffix. Moreover, the FILE(INSTALL ...)
is told to retain its permissions which INSTALL(FILES ...) wouldn't.

The basic idea is: The import library should be installed once with
INSTALL(... ARCHIVE DESTINATION ...) to get the correct permissions,
and you can not modify its name separately from the DLL part before
the INSTALL() command. So, you need to rename it afterwards, either
in the installation directory with knowledge of its suffix, or in a
dedicated intermediate directory where you can use FILE(GLOB ...)
and GET_FILENAME_COMPONENT() without knowing the suffix.

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] CTest outside of CMake

2011-10-17 Thread Tim Gallagher
Hi,

Sorry I wasn't clearer. That section was from a script that we call with ctest. 
The entire section that runs things looks like

# Load our custom settings  
  
ctest_read_custom_files("${CTEST_REPO_DIRECTORY}")
ctest_start("Nightly")
ctest_update()
foreach(TESTCASE ${LESLIE_AVAILABLE_TESTCASES})
  set(CTEST_CONFIGURE_COMMAND "./setup.py -t ${TESTCASE} 
${LESLIE_CONFIGURE_DICT}")
  ctest_configure(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
  set(CTEST_BUILD_COMMAND "./setup.py -t ${TESTCASE} ${LESLIE_BUILD_DICT}")
  ctest_build(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
endforeach()
ctest_test(BUILD "${CTEST_REPO_DIRECTORY}")
ctest_submit()

And we call ctest with 

ctest -S CTestScript.cmake 

My question is, if I only want to run a few tests, ie only run tests 2, 3, 4:

ctest -S CTestScript.cmake -I 2,4

This only run the ctest_test() on tests 2, 3, and 4, but I don't know how to 
determine inside the script which tests will be run, so it configures/builds 
all of the available tests since I have that loop. 

So, is there a variable that gets set or some way to determine which tests are 
called from the command line inside the script in the event something like -I 
or -R flags are used? Is there a variable that contains the list of tests that 
CTest will run?

Hope that's clearer. Thanks,

Tim

- Original Message -
From: "Eric Noulard" 
To: gtg0...@mail.gatech.edu
Cc: cmake@cmake.org
Sent: Monday, October 17, 2011 3:06:48 AM
Subject: Re: [CMake] CTest outside of CMake

2011/10/17 Tim Gallagher :
> Hi,
>
> We have our project set up to run a series of test cases, but we are treating 
> it as if we are not using CMake. I found a tutorial online on how to set it 
> up, and we have it running just fine when we want to run all of the tests. 
> But, I haven't figured out how to do the configure/build steps for selected 
> tests only.
>
> For example, each test has it's own configure command and build command. If I 
> do
>
> ctest -I 2,2
>
> then it configures and builds all the tests, but will only run the second 
> test.
>
> The driver script contains a section like:
>
> foreach(TESTCASE ${LESLIE_AVAILABLE_TESTCASES})
>  set(CTEST_CONFIGURE_COMMAND "./setup.py -t ${TESTCASE} 
> ${LESLIE_CONFIGURE_DICT}")
>  ctest_configure(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
>  set(CTEST_BUILD_COMMAND "./setup.py -t ${TESTCASE} ${LESLIE_BUILD_DICT}")
>  ctest_build(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
> endforeach()
>
> and the LESLIE_AVAILABLE_TESTCASES is a list of test cases names that match 
> the add_test() test names. Is it possible when running CTest with -I or -R 
> (or even without -I or -R) to figure out which tests it selects so we can 
> build LESLIE_AVAILABLE_TESTCASES from that?

I'm not sure to understand your whole testing process flow,
Is the script above part of a ctest -S script?

Filtering some tests may be done with test NAMES or LABELS
see EXCLUDE / INCLUDE or
EXCLUDE_LABEL / INCLUDE_LABEL
 arguments of ctest_test (ctest --help-command ctest_test)

However you does not seem to use ctest_test ?
How do you run your ctest command (which arguments/options are you using)?

Concerning labels
see http://www.kitware.com/blog/home/post/11 and reference therein.



-- 
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] CTest outside of CMake

2011-10-17 Thread David Cole
On Mon, Oct 17, 2011 at 11:04 AM, Tim Gallagher
 wrote:
> Hi,
>
> Sorry I wasn't clearer. That section was from a script that we call with 
> ctest. The entire section that runs things looks like
>
> # Load our custom settings
> ctest_read_custom_files("${CTEST_REPO_DIRECTORY}")
> ctest_start("Nightly")
> ctest_update()
> foreach(TESTCASE ${LESLIE_AVAILABLE_TESTCASES})
>  set(CTEST_CONFIGURE_COMMAND "./setup.py -t ${TESTCASE} 
> ${LESLIE_CONFIGURE_DICT}")
>  ctest_configure(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
>  set(CTEST_BUILD_COMMAND "./setup.py -t ${TESTCASE} ${LESLIE_BUILD_DICT}")
>  ctest_build(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
> endforeach()
> ctest_test(BUILD "${CTEST_REPO_DIRECTORY}")
> ctest_submit()
>
> And we call ctest with
>
> ctest -S CTestScript.cmake
>
> My question is, if I only want to run a few tests, ie only run tests 2, 3, 4:
>
> ctest -S CTestScript.cmake -I 2,4
>
> This only run the ctest_test() on tests 2, 3, and 4, but I don't know how to 
> determine inside the script which tests will be run, so it configures/builds 
> all of the available tests since I have that loop.
>
> So, is there a variable that gets set or some way to determine which tests 
> are called from the command line inside the script in the event something 
> like -I or -R flags are used? Is there a variable that contains the list of 
> tests that CTest will run?
>

No, there is no such variable. The list of tests is not knowable until
after the configure step in a CMake-controlled project. The list of
tests is only read and known internally during the execution of the
ctest_test command. How does ctest even know the list of tests in your
case, when you are running a "setup.py" script as the configure
step...? Are you writing the CTestTestfile.txt files yourself?


> Hope that's clearer. Thanks,
>
> Tim
>
> - Original Message -
> From: "Eric Noulard" 
> To: gtg0...@mail.gatech.edu
> Cc: cmake@cmake.org
> Sent: Monday, October 17, 2011 3:06:48 AM
> Subject: Re: [CMake] CTest outside of CMake
>
> 2011/10/17 Tim Gallagher :
>> Hi,
>>
>> We have our project set up to run a series of test cases, but we are 
>> treating it as if we are not using CMake. I found a tutorial online on how 
>> to set it up, and we have it running just fine when we want to run all of 
>> the tests. But, I haven't figured out how to do the configure/build steps 
>> for selected tests only.
>>
>> For example, each test has it's own configure command and build command. If 
>> I do
>>
>> ctest -I 2,2
>>
>> then it configures and builds all the tests, but will only run the second 
>> test.
>>
>> The driver script contains a section like:
>>
>> foreach(TESTCASE ${LESLIE_AVAILABLE_TESTCASES})
>>  set(CTEST_CONFIGURE_COMMAND "./setup.py -t ${TESTCASE} 
>> ${LESLIE_CONFIGURE_DICT}")
>>  ctest_configure(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
>>  set(CTEST_BUILD_COMMAND "./setup.py -t ${TESTCASE} ${LESLIE_BUILD_DICT}")
>>  ctest_build(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
>> endforeach()
>>
>> and the LESLIE_AVAILABLE_TESTCASES is a list of test cases names that match 
>> the add_test() test names. Is it possible when running CTest with -I or -R 
>> (or even without -I or -R) to figure out which tests it selects so we can 
>> build LESLIE_AVAILABLE_TESTCASES from that?
>
> I'm not sure to understand your whole testing process flow,
> Is the script above part of a ctest -S script?
>
> Filtering some tests may be done with test NAMES or LABELS
> see EXCLUDE / INCLUDE or
> EXCLUDE_LABEL / INCLUDE_LABEL
>  arguments of ctest_test (ctest --help-command ctest_test)
>
> However you does not seem to use ctest_test ?
> How do you run your ctest command (which arguments/options are you using)?
>
> Concerning labels
> see http://www.kitware.com/blog/home/post/11 and reference therein.
>
>
>
> --
> 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
--

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] CTest outside of CMake

2011-10-17 Thread Tim Gallagher
Yes, we're writing the CTestTestfile.cmake with all of the available tests 
using add_test(). So it sounds like there is no way to only configure/build 
selected tests when using CTest outside of CMake, short of hand-writing the 
CTestTestfile with only the desired tests. 

I was going to suggest having a BUILD_COMMAND and CONFIGURE_COMMAND option to 
the add_test() call, but that sounds like that also won't fix the problem 
because the add_test is after the configure/build step. Obviously those would 
not be useful for projects using CMake, but it would be good for ones not using 
CMake. 

The way the entire process is set up -- we have our source code built with 
CMake. All of our test cases were created prior to CMake'ing things and are 
fairly involved to set up, so we have that setup.py script. That script creates 
the bin, input, and output directories, copies over the needed input files, 
etc.. Then it modifies the input files for the specific test case and writes 
out a restart file with the initial conditions. Then, in the bin directory, it 
creates a build directory where it configures CMake for the main code, and 
another build directory where it configures CMake for the utilities. Then it 
builds them all and runs the test cases on our cluster. The tests can be run 
external to ctest with:

./setup.py -t   

and we were trying to wrap all of that process up with CTest and use CDash to 
track the cases. But as users write more test cases, they asked if it was 
possible to make sure their case worked with CTest without having to build/run 
all of the other cases. 

It is like pulling teeth to just get them to add the add_test() line in the 
CTestTestfile even though it's just copy-pasting what's already there, so I was 
hoping there would be a way to do this without making them write custom files 
because I don't think that would actually happen. But, if that's not possible, 
then we'll work with what we have. 

Thanks,

Tim


- Original Message -
From: "David Cole" 
To: gtg0...@mail.gatech.edu
Cc: cmake@cmake.org
Sent: Monday, October 17, 2011 11:54:57 AM
Subject: Re: [CMake] CTest outside of CMake

On Mon, Oct 17, 2011 at 11:04 AM, Tim Gallagher
 wrote:
> Hi,
>
> Sorry I wasn't clearer. That section was from a script that we call with 
> ctest. The entire section that runs things looks like
>
> # Load our custom settings
> ctest_read_custom_files("${CTEST_REPO_DIRECTORY}")
> ctest_start("Nightly")
> ctest_update()
> foreach(TESTCASE ${LESLIE_AVAILABLE_TESTCASES})
>  set(CTEST_CONFIGURE_COMMAND "./setup.py -t ${TESTCASE} 
> ${LESLIE_CONFIGURE_DICT}")
>  ctest_configure(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
>  set(CTEST_BUILD_COMMAND "./setup.py -t ${TESTCASE} ${LESLIE_BUILD_DICT}")
>  ctest_build(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
> endforeach()
> ctest_test(BUILD "${CTEST_REPO_DIRECTORY}")
> ctest_submit()
>
> And we call ctest with
>
> ctest -S CTestScript.cmake
>
> My question is, if I only want to run a few tests, ie only run tests 2, 3, 4:
>
> ctest -S CTestScript.cmake -I 2,4
>
> This only run the ctest_test() on tests 2, 3, and 4, but I don't know how to 
> determine inside the script which tests will be run, so it configures/builds 
> all of the available tests since I have that loop.
>
> So, is there a variable that gets set or some way to determine which tests 
> are called from the command line inside the script in the event something 
> like -I or -R flags are used? Is there a variable that contains the list of 
> tests that CTest will run?
>

No, there is no such variable. The list of tests is not knowable until
after the configure step in a CMake-controlled project. The list of
tests is only read and known internally during the execution of the
ctest_test command. How does ctest even know the list of tests in your
case, when you are running a "setup.py" script as the configure
step...? Are you writing the CTestTestfile.txt files yourself?


> Hope that's clearer. Thanks,
>
> Tim
>
> - Original Message -
> From: "Eric Noulard" 
> To: gtg0...@mail.gatech.edu
> Cc: cmake@cmake.org
> Sent: Monday, October 17, 2011 3:06:48 AM
> Subject: Re: [CMake] CTest outside of CMake
>
> 2011/10/17 Tim Gallagher :
>> Hi,
>>
>> We have our project set up to run a series of test cases, but we are 
>> treating it as if we are not using CMake. I found a tutorial online on how 
>> to set it up, and we have it running just fine when we want to run all of 
>> the tests. But, I haven't figured out how to do the configure/build steps 
>> for selected tests only.
>>
>> For example, each test has it's own configure command and build command. If 
>> I do
>>
>> ctest -I 2,2
>>
>> then it configures and builds all the tests, but will only run the second 
>> test.
>>
>> The driver script contains a section like:
>>
>> foreach(TESTCASE ${LESLIE_AVAILABLE_TESTCASES})
>>  set(CTEST_CONFIGURE_COMMAND "./setup.py -t ${TESTCASE} 
>> ${LESLIE_CONFIGURE_DICT}")
>>  ctest_configure(BUILD "${CTEST_REP

[CMake] Environment variables and ExternalProject

2011-10-17 Thread Milutin Jovanović
Hi all,

Hi all. First time posting. Before I start I'd like to thank all the Kitware
guys for a very nice and useful tool. I did a fair bit of searching to try
to avoid asking duplicate questions, but did not find answer to my problem.

I am trying to make a private build of some dependencies, ogg and vorbis in
this case. The initial problem is that second library make is not finding
first, due to pkg-config not finding output files from the first library.
OK, I said, and did PKG_CONFIG_PATH=... and export PKG_CONFIG_PATH before
executing cmake build. And this fixed the problem.

However then I tried to ease the job of whoever might be using this, and
tried setting the PKG_CONFIG_PATH inside the cmake script. But this does not
work. I did some tests, and indeed, configure executed as part of
ExternalProject does not see environmental variables set by cmake.

So, the question is, am I doing something wrong or is this cmake limitation?

Miki.

P.S. I am doing this on a Mac OSX Lion, but I expect it to work on Linux
without modifications.

=== CMakeLists.txt ===

cmake_minimum_required(VERSION 2.8)

set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Path where to
install.")

project(dependecies)

include(ExternalProject)

set(ENV{PKG_CONFIG_PATH}
"${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/:$ENV{PKG_CONFIG_PATH}")
message(STATUS "PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}")

ExternalProject_Add(
libogg
PREFIX libogg
URL http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
URL_MD5 0a7eb40b86ac050db3a789ab65fe21c2
UPDATE_COMMAND set
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_INSTALL_PREFIX}
   BUILD_COMMAND make
# INSTALL_COMMAND make install
   BUILD_IN_SOURCE 1
)

ExternalProject_Add(
libvorbis
DEPENDS libogg
PREFIX libvorbis
URL http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
URL_MD5 798a4211221073c1409f26eac4567e8b
UPDATE_COMMAND set
CONFIGURE_COMMAND PKG_CONFIG_PATH=${CMAKE_INSTALL_PREFIX}/lib/pkgconfig
&& export PKG_CONFIG_PATH && set && ./configure
--prefix=${CMAKE_INSTALL_PREFIX} --with-ogg=${CMAKE_INSTALL_PREFIX}
BUILD_COMMAND make
# INSTALL_COMMAND make install
   BUILD_IN_SOURCE 1
)
--

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] Environment variables and ExternalProject

2011-10-17 Thread Luigi Calori

On 17/10/2011 18.27, Milutin Jovanovic' wrote:


Hi all,

Hi all. First time posting. Before I start I'd like to thank all the 
Kitware guys for a very nice and useful tool. I did a fair bit of 
searching to try to avoid asking duplicate questions, but did not find 
answer to my problem.


I am trying to make a private build of some dependencies, ogg and 
vorbis in this case. The initial problem is that second library make 
is not finding first, due to pkg-config not finding output files from 
the first library. OK, I said, and did PKG_CONFIG_PATH=... and export 
PKG_CONFIG_PATH before executing cmake build. And this fixed the problem.


However then I tried to ease the job of whoever might be using this, 
and tried setting the PKG_CONFIG_PATH inside the cmake script. But 
this does not work. I did some tests, and indeed, configure executed 
as part of ExternalProject does not see environmental variables set by 
cmake.


So, the question is, am I doing something wrong or is this cmake 
limitation?
I' m not really sure, but I think it is a CMake limitation that has been 
discussed before:

When you do

set(ENV{PKG_CONFIG_PATH} 
"${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/:$ENV{PKG_CONFIG_PATH}")


I think that you are setting the environment for the current cmake 
process and all it' s child processes.


The problem is that when you use ExternalProject_Add() you are building 
a Makefile that will be processed at "build" time whwn you invoke make 
(or a XCode ide processing)


That process is NOT a child of your cmake, so the env is lost

As far as I know, there is (unfortunately) no ENV clause in 
ExternalProcess,  so the only (ugly) workaround that I have found is to 
define a wrapper of the two configure and make processes that pass the 
env you need like:


1) using the included pkgconfig_env.cmake
2) calling the wrapper script as I' ve tried to show subsequently by 
modifying your second call


There could be a simpler way in your case, but I' ve included this as is 
what I' m using for packaging external libraries.


I would really like to have an ENV clause in ExternalProcess to force 
all the called steps to have a defined environment


HTH
  Luigi












Miki.

P.S. I am doing this on a Mac OSX Lion, but I expect it to work on 
Linux without modifications.


=== CMakeLists.txt ===

cmake_minimum_required(VERSION 2.8)

set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Path where to 
install.")


project(dependecies)

include(ExternalProject)

set(ENV{PKG_CONFIG_PATH} 
"${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/:$ENV{PKG_CONFIG_PATH}")

message(STATUS "PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}")

ExternalProject_Add(
libogg
PREFIX libogg
URL http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
URL_MD5 0a7eb40b86ac050db3a789ab65fe21c2
UPDATE_COMMAND set
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_INSTALL_PREFIX}
   BUILD_COMMAND make
# INSTALL_COMMAND make install
   BUILD_IN_SOURCE 1
)

set(_mymoduledir < where you put the included file 
pkgconfig_env.cmake -->
set(conf_command_body ./configure --prefix=${CMAKE_INSTALL_PREFIX}  
--with-ogg=${CMAKE_INSTALL_PREFIX}

string(REPLACE ";" "@@" managed_conf_command_body "${conf_command_body}" )
 set(conf_command CONFIGURE_COMMAND ${CMAKE_COMMAND} 
-Dmy_binary_dir:PATH= -Dmy_source_dir:PATH= 
-Dmy_install_dir:PATH=${CMAKE_INSTALL_PREFIX} 
-Dmy_configure:STRING=${managed_conf_command_body} -P 
${_mymoduledir}/pkgconfig_env.cmake)


set(make_command_body make --jobs 4)
string(REPLACE ";" "@@" managed_make_command_body "${make_command_body}" )
set(make_command BUILD_COMMAND ${CMAKE_COMMAND} 
-Dmy_binary_dir:PATH= -Dmy_source_dir:PATH= 
-Dmy_install_dir:PATH=${CMAKE_INSTALL_PREFIX} 
-Dmy_configure:STRING=${managed_make_command_body} -P 
${_mymoduledir}/pkgconfig_env.cmake)

 set(list_separator "LIST_SEPARATOR @@")


ExternalProject_Add(
libvorbis
DEPENDS libogg
PREFIX libvorbis
URL http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
URL_MD5 798a4211221073c1409f26eac4567e8b
UPDATE_COMMAND set

${conf_command}
${make_command}
${list_separator}


# INSTALL_COMMAND make install
   BUILD_IN_SOURCE 1
)



--

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



--
Luigi Calori
SuperComputing Applications and Innovation Department
CINECA - via Magnanelli, 6/3, 40033 Casalecchio di Reno (Bologna) - ITALY
Tel: +39 051 6171509  Fax: +39 051 6132198
hpc.cineca.it

set(ENV{PATH} "${my_install_dir}/bin:$ENV{PATH}")
string(REPLACE "@@" ";" my_configure "${my_configure}" )

set(ENV{PKG_CONFIG_PATH} ${my_install_dir}/lib/pkgconfig)
set(ENV{LD_LIBRARY_PATH} ${my_install_dir}/

Re: [CMake] CTest outside of CMake

2011-10-17 Thread David Cole
You could approach it in a different way:

Rather than having the end user running ctest control what tests are
run with -I or -R, you could have them provide a file that lists the
tests to run. Then you could construct the list from that file, run
only the configure/build steps that are necessary, and then use
ctest_test along with its INCLUDE argument to limit the tests to the
set specified.

Just an idea.


HTH,
David


On Mon, Oct 17, 2011 at 12:12 PM, Tim Gallagher
 wrote:
> Yes, we're writing the CTestTestfile.cmake with all of the available tests 
> using add_test(). So it sounds like there is no way to only configure/build 
> selected tests when using CTest outside of CMake, short of hand-writing the 
> CTestTestfile with only the desired tests.
>
> I was going to suggest having a BUILD_COMMAND and CONFIGURE_COMMAND option to 
> the add_test() call, but that sounds like that also won't fix the problem 
> because the add_test is after the configure/build step. Obviously those would 
> not be useful for projects using CMake, but it would be good for ones not 
> using CMake.
>
> The way the entire process is set up -- we have our source code built with 
> CMake. All of our test cases were created prior to CMake'ing things and are 
> fairly involved to set up, so we have that setup.py script. That script 
> creates the bin, input, and output directories, copies over the needed input 
> files, etc.. Then it modifies the input files for the specific test case and 
> writes out a restart file with the initial conditions. Then, in the bin 
> directory, it creates a build directory where it configures CMake for the 
> main code, and another build directory where it configures CMake for the 
> utilities. Then it builds them all and runs the test cases on our cluster. 
> The tests can be run external to ctest with:
>
> ./setup.py -t   
>
> and we were trying to wrap all of that process up with CTest and use CDash to 
> track the cases. But as users write more test cases, they asked if it was 
> possible to make sure their case worked with CTest without having to 
> build/run all of the other cases.
>
> It is like pulling teeth to just get them to add the add_test() line in the 
> CTestTestfile even though it's just copy-pasting what's already there, so I 
> was hoping there would be a way to do this without making them write custom 
> files because I don't think that would actually happen. But, if that's not 
> possible, then we'll work with what we have.
>
> Thanks,
>
> Tim
>
>
> - Original Message -
> From: "David Cole" 
> To: gtg0...@mail.gatech.edu
> Cc: cmake@cmake.org
> Sent: Monday, October 17, 2011 11:54:57 AM
> Subject: Re: [CMake] CTest outside of CMake
>
> On Mon, Oct 17, 2011 at 11:04 AM, Tim Gallagher
>  wrote:
>> Hi,
>>
>> Sorry I wasn't clearer. That section was from a script that we call with 
>> ctest. The entire section that runs things looks like
>>
>> # Load our custom settings
>> ctest_read_custom_files("${CTEST_REPO_DIRECTORY}")
>> ctest_start("Nightly")
>> ctest_update()
>> foreach(TESTCASE ${LESLIE_AVAILABLE_TESTCASES})
>>  set(CTEST_CONFIGURE_COMMAND "./setup.py -t ${TESTCASE} 
>> ${LESLIE_CONFIGURE_DICT}")
>>  ctest_configure(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
>>  set(CTEST_BUILD_COMMAND "./setup.py -t ${TESTCASE} ${LESLIE_BUILD_DICT}")
>>  ctest_build(BUILD "${CTEST_REPO_DIRECTORY}" APPEND)
>> endforeach()
>> ctest_test(BUILD "${CTEST_REPO_DIRECTORY}")
>> ctest_submit()
>>
>> And we call ctest with
>>
>> ctest -S CTestScript.cmake
>>
>> My question is, if I only want to run a few tests, ie only run tests 2, 3, 4:
>>
>> ctest -S CTestScript.cmake -I 2,4
>>
>> This only run the ctest_test() on tests 2, 3, and 4, but I don't know how to 
>> determine inside the script which tests will be run, so it configures/builds 
>> all of the available tests since I have that loop.
>>
>> So, is there a variable that gets set or some way to determine which tests 
>> are called from the command line inside the script in the event something 
>> like -I or -R flags are used? Is there a variable that contains the list of 
>> tests that CTest will run?
>>
>
> No, there is no such variable. The list of tests is not knowable until
> after the configure step in a CMake-controlled project. The list of
> tests is only read and known internally during the execution of the
> ctest_test command. How does ctest even know the list of tests in your
> case, when you are running a "setup.py" script as the configure
> step...? Are you writing the CTestTestfile.txt files yourself?
>
>
>> Hope that's clearer. Thanks,
>>
>> Tim
>>
>> - Original Message -
>> From: "Eric Noulard" 
>> To: gtg0...@mail.gatech.edu
>> Cc: cmake@cmake.org
>> Sent: Monday, October 17, 2011 3:06:48 AM
>> Subject: Re: [CMake] CTest outside of CMake
>>
>> 2011/10/17 Tim Gallagher :
>>> Hi,
>>>
>>> We have our project set up to run a series of test cases, but we are 
>>> treating it as if we are not using CMake. I found a tutor

Re: [CMake] FindLAPACK in git head

2011-10-17 Thread Tim Gallagher
I'm still trying to figure this one out. I went in an unset _libdir and 
manually set it to include the mkl path (even though it is the first thing on 
the LD_LIBRARY_PATH) and it still can't find it. In other words, 

set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 
/opt/intel/Compiler/11.1/072/mkl/lib/em64t)

And 

|13:35||tgallagher@harpy:bin_LEM_splicing|> ls  
/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_lapack*
/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_lapack95_ilp64.a  
/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_lapack95_lp64.a  
/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_lapack.so

And if I leave _libdir untouched so that it ends with ENV LD_LIBRARY_PATH, it 
also cannot find it even though:

|13:35||tgallagher@harpy:bin_LEM_splicing|> echo $LD_LIBRARY_PATH
/opt/intel/Compiler/11.1/072/mkl/lib/em64t:...

I'm stumped. 

Tim

- Original Message -
From: "Rolf Eike Beer" 
To: cmake@cmake.org
Sent: Monday, October 17, 2011 3:47:34 AM
Subject: Re: [CMake] FindLAPACK in git head

> Hi,
>
> We're having problems with FindLAPACK in the latest source head. It claims
> it cannot find LAPACK when previous versions of CMake find it just fine.
> It does not work with either the Generic version or the Intel version.
> FindBLAS correctly locates the library though.

No idea so far.

> And when we put in the path for the LAPACK_mkl_lapack_LIBRARY variable, it
> doesn't complain. But then during linking, we get:
>
> /opt/intel/Compiler/11.1/072/lib/intel64/libguide.so: undefined reference
> to `pthread_atfork'
> make[2]: *** [derivative/unitTests/utDerivativeTestc] Error 1
>
> even though libpthread.so exists and is on the library path in /usr/lib.

That means that you need to link against the pthread library. The problem
here is not that the library is not found, but that you did not tell CMake
to use it. Usually this is done by the LAPACK module, so the main reason
you are seeing this at all is that it did not find your library in the
first place.

Eike

Eike
--

Powered by www.kitware.com

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

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

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

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] Environment variables and ExternalProject

2011-10-17 Thread Milutin Jovanović
Thanks Luigi. I feared a workaround was necessary. I will go over your
suggestion and try to apply it.

I'll second your suggestion for providing environment variables for
ExternalProjects.

Miki.
--

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] Environment variables and ExternalProject

2011-10-17 Thread David Cole
For now, a wrapper script is definitely the way to do this.

We need the ability to specify environment values generically in the
"add_custom_command" command. Once we have that, adding support to
ExternalProject will be trivial. Until we have that, a wrapper script
work-around is valid now and will still be valid after we add that
feature.

There are no concrete plans that I am aware of to do this work in the
near future. But when it is done (eventually), you'll probably hear
about it first here on this mailing list...


Thanks,
David C.


2011/10/17 Milutin Jovanović :
>
> Thanks Luigi. I feared a workaround was necessary. I will go over your
> suggestion and try to apply it.
>
> I'll second your suggestion for providing environment variables for
> ExternalProjects.
>
> Miki.
>
>
> --
>
> 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] Windows 8 and Visual Studio 2011 Developer Preview cannot open cmake-generated vcproj files

2011-10-17 Thread Claudio Bantaloukas
Hi *
I have installed the windows developer preview with visual studio 2011.
I tried to use cmake 2.8.6 to generate a project but:
- when I try to open the sln file, I get a modal dialog saying that the
format is not recognized
(in fact the .sln file can be opened if I change the header to
--
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 11 Express for Windows 8
--
)
- when I manage to open the solution file, I get another dialog saying that
the project target framework is not installed: (the Visual C++ project
"ALL_BUILD" is targeting ".NETFramework,Version=4.0", which is not installed
on this machine. You must download this framework in order to open and build
this project.
I am then guided to the Framework Download Web Site which is asking me to
download framework versions for visual studio 2010 (
http://go.microsoft.com/fwlink/?LinkId=122841 )

Ideas on how to make this work? Other than ditching this experiment
alltogether that is? ;)

-- 
Claudio Bantaloukas http://www.rdfm.org/ammuzzu/
--

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] Windows 8 and Visual Studio 2011 Developer Preview cannot open cmake-generated vcproj files

2011-10-17 Thread Andreas Pakulat
On 18.10.11 00:25:00, Claudio Bantaloukas wrote:
> Hi *
> I have installed the windows developer preview with visual studio 2011.
> I tried to use cmake 2.8.6 to generate a project but:
> - when I try to open the sln file, I get a modal dialog saying that the
> format is not recognized
> (in fact the .sln file can be opened if I change the header to
> --
> Microsoft Visual Studio Solution File, Format Version 12.00
> # Visual Studio 11 Express for Windows 8
> --
> )
> - when I manage to open the solution file, I get another dialog saying that
> the project target framework is not installed: (the Visual C++ project
> "ALL_BUILD" is targeting ".NETFramework,Version=4.0", which is not installed
> on this machine. You must download this framework in order to open and build
> this project.
> I am then guided to the Framework Download Web Site which is asking me to
> download framework versions for visual studio 2010 (
> http://go.microsoft.com/fwlink/?LinkId=122841 )
> 
> Ideas on how to make this work? Other than ditching this experiment
> alltogether that is? ;)

Add a VS 2011 generator to CMake which generates the correct solution
files and post the patch to a corresponding bugreport in the tracker.

Andreas

--

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] Anybody succeeded with VS/NASM?

2011-10-17 Thread Vladimir Chebotarev
Hi.

I'm trying to compile .cpp file along with .asm on Visual Studio.
It correctly finds NASM assembler, but .asm file seems not to be included to 
build.

Have tried VS 2005 and 2010, cmake 2.8.6 and 2.8.6-20111015.
It works on linux/make generators of course.

-- 
Best Regards,
Vladimir.
--

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