Re: [CMake] How to see the generated compiler commands?

2010-06-08 Thread Michael Hertling
On 06/08/2010 07:02 PM, Torri, Stephen CIV NSWCDD, W15 wrote:
>> From: cmake-boun...@cmake.org on behalf of Felipe Sodré Silva
>> Sent: Tue 6/8/2010 12:43 PM
>> To: cmake@cmake.org
>> Subject: [CMake] How to see the generated compiler commands?
>>
>>
>> Hi, I wrote a cmake script that generates a unix makefile for a project, and 
>> I'd like to know if there's an easy 
>> way to see the compiler arguments the make system is using to build the 
>> project. Looking at the generated 
>> Makefile doesn't seem to be an option.
> 
> Yes there is. To see what is being done do the following:
>  
> make VERBOSE=1

Alternatively, you can set the CMAKE_VERBOSE_MAKEFILE variable to
TRUE in the CMakeLists.txt to enable verbose "making" by default.

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] dependency problem

2010-06-08 Thread Yifei Li

> 
> Thank you.
> 
> The reason I used find_library is because I found out that I don't need to 
> say libMyLib.so or libMyLib.dylib in target_link_libraries, I can just say 
> MyLib.
> 
> Correct me if I am wrong
> 
> Yifei
> On Jun 8, 2010, at 4:21 PM, Torri, Stephen CIV NSWCDD, W15 wrote:
> 
>>> From: cmake-boun...@cmake.org on behalf of Yifei Li
>>> Sent: Tue 6/8/2010 4:15 PM
>>> To: cmake@cmake.org
>>> Subject: Re: [CMake] dependency problem
>>> 
>>> Thank you for reply.
>>> 
>>> I already tried that.  I think the problem was caused by 'find_library' in 
>>> my plugin's CMakeLists.txt, because it failed to find 
>>> MyLib
>>> 
>>> I use a variable to hold the result of 'find_library'  and that variable is 
>>> in turn used in target_link_libraries
>> 
>> Assuming both "MyLib" and the plugin exist in the same project I could do 
>> this
>> 
>> (CMakeLists.txt for MyLib)
>> add_library ( MyLib SHARED ${SOURCE})
>> 
>> (CMakeLists.txt for plugin)
>> add_dependencies ( MyLib )
>> add_library ( plugin SHARED ${SOURCE} )
>> target_link_libraries ( plugin MyLib )
>> 
>> I don't see you needing to use find_library. That is intended to find a 
>> library external to the existing project. It should not be necessary to find 
>> a library internal to a project.
>> 
>> Stephen
>> 
>> 
>> ___
>> 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] decision based on being a nested project

2010-06-08 Thread Michael Hertling
On 06/08/2010 09:00 PM, Nathan Huesken wrote:
> Hi,
> 
> As can be read in an earlier thread, I am trying to nest a cmake
> project (call it "inner") into another cmake project (call it "outer").
> The "inner" project should be extracable and run as its own project.
> 
> Having trouble with EXTERNALPROJECT_ADD, I am trying to add the project
> as a subdir. So I have something like this:
> - rootdir
>   CMakeFile: Project(outer)
>   - lib
> CMakeFile: Add_Subdirectory(inner)
> - inner
>   CMakeFile: Project(inner)
>   - doc
> CMakeFile: Add_target(doc)
>   - doc
> CMakeFile: Add_target(doc)
> ...
> 
> The problem now is, that the target "doc" exists twice, cmake
> complaints.
> 
> So I would rename the inner target to "inner_doc", and add it as a
> dependency of "doc".
> But as said the inner project should also work on is own.
> So I would do:
> 
> IF_IS_NESTED_PROJECT
>   add_target(inner_doc)
> ELSE
>   add_target(doc)
> ENDIF
> 
> My question: How can I find out if inner is configured as inner project
> of outer or as a standalone project? (How can I do the
> IF_IS_NESTED_PROJECT)?

You can use PROJECT_SOURCE_DIR and CMAKE_SOURCE_DIR to distinguish:

CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(OUTER NONE)
MESSAGE("PROJECT: OUTER")
ADD_SUBDIRECTORY(inner)

inner/CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(INNER NONE)
IF(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
MESSAGE("PROJECT: INNER (STAND-ALONE)")
ELSE()
MESSAGE("PROJECT: INNER (SUBORDINATE)")
ENDIF()

Issuing "cmake " yields

PROJECT: OUTER
PROJECT: INNER (SUBORDINATE)
[...]

and "cmake /inner" results in

PROJECT: INNER (STAND-ALONE)
[...]

i.e. your "IF_IS_NESTED_PROJECT" effectively is:

IF(NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)

'hope that helps.

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] dependency problem

2010-06-08 Thread Michael Hertling
On 06/08/2010 10:21 PM, Torri, Stephen CIV NSWCDD, W15 wrote:
>> From: cmake-boun...@cmake.org on behalf of Yifei Li
>> Sent: Tue 6/8/2010 4:15 PM
>> To: cmake@cmake.org
>> Subject: Re: [CMake] dependency problem
>>
>> Thank you for reply.
>>
>> I already tried that.  I think the problem was caused by 'find_library' in 
>> my plugin's CMakeLists.txt, because it failed to find 
>> MyLib
>>
>> I use a variable to hold the result of 'find_library'  and that variable is 
>> in turn used in target_link_libraries
> 
> Assuming both "MyLib" and the plugin exist in the same project I could do this
>  
> (CMakeLists.txt for MyLib)
> add_library ( MyLib SHARED ${SOURCE})
>  
> (CMakeLists.txt for plugin)
> add_dependencies ( MyLib )

Illegal as it would add a dependency *of* MyLib *on* nothing.

> add_library ( plugin SHARED ${SOURCE} )
> target_link_libraries ( plugin MyLib )
>  
> I don't see you needing to use find_library. That is intended to find a 
> library external to the existing project. It should not be necessary to find 
> a library internal to a project.

You even don't need ADD_DEPENDENCIES() in the plugins' CMakeLists.txt
files as TARGET_LINK_LIBRARIES() tracks such dependencies by itself.

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] ${PROJECT}-config.cmake

2010-06-08 Thread Michael Hertling
On 06/07/2010 08:54 PM, Biddiscombe, John A. wrote:
> Seems that just doing
> 
> IF (NOT ${PROJECTXXX_SOURCE_DIR})
>  include config file
> ENDIF
> 
> is enough and works ok. If the project is part of the same build, the source 
> dir is defined, otherwise not.

To me, this seems not to be bulletproof: Even if you're outside that
particular project the superordinate environment could define such a
variable for a completely unrelated purpose, so the file surprisingly
wouldn't be included. Here, IMO, "IF(NOT TARGET ...)" is more reliable.

Regards,

Michael

>> -Original Message-
>> From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of
>> Biddiscombe, John A.
>> Sent: 07 June 2010 17:25
>> To: cmake@cmake.org
>> Subject: [CMake] ${PROJECT}-config.cmake
>>
>> When using the install target command as follows
>>
>>
>>
>>   INSTALL (
>>
>>   TARGETS
>>
>>   ${HDF5_LIB_TARGET}
>>
>>   EXPORT
>>
>>   ${HDF5_EXPORTED_TARGETS}
>>
>>   LIBRARY DESTINATION lib COMPONENT libraries
>>
>>   ARCHIVE DESTINATION lib COMPONENT libraries
>>
>>   RUNTIME DESTINATION bin COMPONENT libraries
>>
>>   )
>>
>>
>>
>> cmake very nicely generates an HDF5-config.cmake file in the build
>> directory, and at install time, in the install directory. This is great.
>>
>>
>>
>> However, I have project A(paraview) with two subdirectories B (hdf5) and C
>> (mystuff), where C "uses" B. All is well except that if C includes the hdf5-
>> config.cmake from the Build directory as generated by B (ADD_LIBRARY(vtkhdf5
>> SHARED IMPORTED)) , cmake produces error messages along the lines of
>>
>>
>>
>> CMake Error at D:/cmakebuild/pv-shared/Utilities/hdf5-1.8/HDF5-
>> config.cmake:16 (ADD_LIBRARY):
>>
>> add_library cannot create imported target "vtkhdf5" because another target
>>
>> with the same name already exists.
>>
>>
>>
>> Naturally, when building C standalone using the install directory of
>> standalone B, all works fine.
>>
>>
>>
>> Everything would be simple, if cmake would simply skip the imported target
>> from B the second time it is loaded when called from the subproject C, then
>> a single set of config and cmakelists would work all the time, but as it is,
>> extra logic needs to be added.
>>
>>
>>
>> Is there any easy way of telling project C, load the config file if B is not
>> part of the same build so that I can reuse the same syntax between separate
>> build or common builds. I'd like to use the generated hdf5-config.cmake
>> files because they have all the necessary properties set correctly (like
>> when target name is not the same as lib name etc etc, which makes things
>> harder like below).
>>
>>
>>
>> # Import target "vtkhdf5" for configuration "Debug"
>>
>> SET_PROPERTY(TARGET vtkhdf5 APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
>>
>> SET_TARGET_PROPERTIES(vtkhdf5 PROPERTIES
>>
>>   IMPORTED_IMPLIB_DEBUG "D:/cmakebuild/pv-shared/bin/Debug/vtkhdf5ddll.lib"
>>
>>   IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "ws2_32;wsock32;C:/Program
>> Files/MPICH2/lib/mpi.lib;vtkzlib"
>>
>>   IMPORTED_LOCATION_DEBUG "D:/cmakebuild/pv-
>> shared/bin/Debug/vtkhdf5ddll.dll"
>>
>>   )
>>
>>
>>
>> Thanks
>>
>>
>>
>> JB
>>
>>
>>
>>
>>
>> --
>>
>> John Biddiscombe,email:biddisco @ cscs.ch
>>
>> http://www.cscs.ch/ 
>>
>> CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
>>
>> Via Cantonale, 6928 Manno, Switzerland  | Fax:  +41 (91) 610.82.82
>>
>>

___
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] OpenMP differences between command line and Xcode

2010-06-08 Thread Daniel Blezek
Hi,

  We¹ve just started building our OpenMP based code using Xcode on Mac OS X
10.6.  When we build using Makefiles with OpenMP turned on (through the
FindOpenMP.cmake module), all goes well.  Under Xcode, however, we are not
linking to the OpenMP libraries.  I tracked this down to a difference in the
final link line.

Under Makefiles we have:

Linking CXX executable ../bin/NoOp

/usr/bin/c++  -fopenmp


Under Xcode, the ­fopenmp flag is missing.  I suspected that the Makefiles
are using OpenMP_CXX_FLAGS ³under the hood², but the same code is not being
used by the Xcode generator.  Can anyone help out with this issue?

Cheers,
-dan

P.S.  The simple workaround is to set
CMAKE_EXE_LINKER_FLAGS:STRING=-fopenmp
in CMakeCache.txt


-- 
Daniel Blezek, PhD
Medical Imaging Informatics Innovation Center

P 127 or (77) 8 8886
T 507 538 8886
E blezek.dan...@mayo.edu

Mayo Clinic
200 First St. S.W.
Harwick SL-44
Rochester, MN 55905
mayoclinic.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] ${PROJECT}-config.cmake

2010-06-08 Thread Michael Hertling
On 06/07/2010 05:24 PM, Biddiscombe, John A. wrote:
> When using the install target command as follows
> 
>   INSTALL (
>   TARGETS
>   ${HDF5_LIB_TARGET}
>   EXPORT
>   ${HDF5_EXPORTED_TARGETS}
>   LIBRARY DESTINATION lib COMPONENT libraries
>   ARCHIVE DESTINATION lib COMPONENT libraries
>   RUNTIME DESTINATION bin COMPONENT libraries
>   )
> 
> cmake very nicely generates an HDF5-config.cmake file in the build directory, 
> and at install time, in the install directory. This is great.

AFAIK, those files generated by the INSTALL(TARGETS ... EXPORT ...)
and INSTALL(EXPORT ...) commands concerning imported targets are not
intended to be used as config files for a package; accordingly, they
should not be named *-config.cmake as this has a special meaning for
FIND_PACKAGE(). Preferably, they are named *-targets.cmake instead.

> However, I have project A(paraview) with two subdirectories B (hdf5) and C 
> (mystuff), where C "uses" B. All is well except that if C includes the 
> hdf5-config.cmake from the Build directory as generated by B 
> (ADD_LIBRARY(vtkhdf5 SHARED IMPORTED)) , cmake produces error messages along 
> the lines of
> 
> CMake Error at 
> D:/cmakebuild/pv-shared/Utilities/hdf5-1.8/HDF5-config.cmake:16 (ADD_LIBRARY):
> add_library cannot create imported target "vtkhdf5" because another target
> with the same name already exists.

So, B and C are built within the same project A, right? In this case,
you could refer directly to B's targets whereas imported targets are
meant to be provided by outside projects. Btw, where do you get the
hdf5-config.cmake from for its inclusion at CMake time, i.e. before
installation? IIRC, the time it is generated at and the location it
is written to are not mentioned in the docs, and can you be sure it
is not changed during installation? Here, IMO, you're relying on
undocumented behaviour.

> Naturally, when building C standalone using the install directory of 
> standalone B, all works fine.

This means C could *also* be built using an already installed B, right?
In this case, B should provide a config file, say b-config.cmake, that
includes the targets file, say b-targets.cmake, and protects that
inclusion to prevent multiple definitions of the targets, e.g.:

IF(NOT TARGET "vtkhdf5")
INCLUDE(/b-targets.cmake)
ENDIF()
SET(B_LIBRARIES "vtkhdf5")
SET(B_INCLUDE_DIRS ...)
SET(B_DEFINITIONS ...)

When building C, you can issue FIND_PACKAGE(B ...) to enable B, but you
should not mix these cases, i.e. you should set up C to use either the
"builtin" B or the externally installed B, e.g. in C's CMakeLists.txt:

IF(USE_BUILTIN_B)
LIST(APPEND LIBRARIES "vtkhdf5")
ADD_DEFINITIONS()
INCLUDE_DIRECTORIES()
ELSE()
FIND_PACKAGE(B REQUIRED ...)
LIST(APPEND LIBRARIES ${B_LIBRARIES})
ADD_DEFINITIONS(${B_DEFINITIONS})
INCLUDE_DIRECTORIES(${B_INCLUDE_DIRS})
ENDIF()
...
TARGET_LINK_LIBRARIES(... ${LIBRARIES})

Thus, you have an explicit distinction between the alternatives without
relying on the availability of B's targets file in the build directory,
and if B can be installed as a stand-alone package it should provide a
config file for itself anyway.

> Everything would be simple, if cmake would simply skip the imported target 
> from B the second time it is loaded when called from the subproject C, then a 
> single set of config and cmakelists would work all the time, but as it is, 
> extra logic needs to be added.
> 
> Is there any easy way of telling project C, load the config file if B is not 
> part of the same build so that I can reuse the same syntax between separate 
> build or common builds. I'd like to use the generated hdf5-config.cmake files 
> because they have all the necessary properties set correctly (like when 
> target name is not the same as lib name etc etc, which makes things harder 
> like below).
> 
> # Import target "vtkhdf5" for configuration "Debug"
> SET_PROPERTY(TARGET vtkhdf5 APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
> SET_TARGET_PROPERTIES(vtkhdf5 PROPERTIES
>   IMPORTED_IMPLIB_DEBUG "D:/cmakebuild/pv-shared/bin/Debug/vtkhdf5ddll.lib"
>   IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG "ws2_32;wsock32;C:/Program 
> Files/MPICH2/lib/mpi.lib;vtkzlib"
>   IMPORTED_LOCATION_DEBUG "D:/cmakebuild/pv-shared/bin/Debug/vtkhdf5ddll.dll"
>   )

If you really want to use the targets file of B internally during the
build - which I would not recommend - you can protect each INCLUDE()
of that file with "IF(NOT TARGET ...)" as shown above in order to
reliably prevent multiple inclusions.

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] How to see the generated compiler commands?

2010-06-08 Thread Chris Hillery
On Tue, Jun 8, 2010 at 10:02 AM, Torri, Stephen CIV NSWCDD, W15 <
stephen.to...@navy.mil> wrote:

> > From: cmake-boun...@cmake.org on behalf of Felipe Sodré Silva>
> >
> > Hi, I wrote a cmake script that generates a unix makefile for a project,
> and I'd like to know if there's an easy
> > way to see the compiler arguments the make system is using to build the
> project. Looking at the generated
> > Makefile doesn't seem to be an option.
>
> Yes there is. To see what is being done do the following:
>
> make VERBOSE=1
>
>
FYI:

http://www.cmake.org/Wiki/CMake_FAQ

Question 2.1. There's a lot of other good stuff in there too! :)

Ceej
aka Chris Hillery
___
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] dependency problem

2010-06-08 Thread Torri, Stephen CIV NSWCDD, W15
> From: cmake-boun...@cmake.org on behalf of Yifei Li
> Sent: Tue 6/8/2010 4:15 PM
> To: cmake@cmake.org
> Subject: Re: [CMake] dependency problem
> 
> Thank you for reply.
> 
> I already tried that.  I think the problem was caused by 'find_library' in my 
> plugin's CMakeLists.txt, because it failed to find 
> MyLib
> 
> I use a variable to hold the result of 'find_library'  and that variable is 
> in turn used in target_link_libraries

Assuming both "MyLib" and the plugin exist in the same project I could do this
 
(CMakeLists.txt for MyLib)
add_library ( MyLib SHARED ${SOURCE})
 
(CMakeLists.txt for plugin)
add_dependencies ( MyLib )
add_library ( plugin SHARED ${SOURCE} )
target_link_libraries ( plugin MyLib )
 
I don't see you needing to use find_library. That is intended to find a library 
external to the existing project. It should not be necessary to find a library 
internal to a project.
 
Stephen
 
 
___
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] Building multiple releases for a visual studio project

2010-06-08 Thread Torri, Stephen CIV NSWCDD, W15
> From: John Drescher [mailto:dresche...@gmail.com]
> Sent: Tue 6/8/2010 3:55 PM
> To: Torri, Stephen CIV NSWCDD, W15
> Cc: cmake@cmake.org
> Subject: Re: [CMake] Building multiple releases for a visual studio project
> 
> > On Tue, Jun 8, 2010 at 2:52 PM, Torri, Stephen CIV NSWCDD, W15 
> >  wrote:
> > I was wondering if it was possible to have a CMake project that builds a 
> > Microsoft Visual Studio Project produce an 
> > NSIS installer for each kind of build (e.g. debug, release, RelWithDebug). 
> > Right now I can build the project via Visual 
> > Studio for all the build types which is great. Now I would like to have one 
> > NSIS installer for each type. Is that possible?
>
> 
> Copy the package then switch the build type in visual studio and then
> run package. The file overwrites the previous nsis package with the
> same name but I am pretty sure it builds for the current
> configuration.

I see I can do "cpack -G NSIS -C Debug ../" from my build directory to get it 
to produce a NSIS file for the debug version. It would be nice to be able to 
set a name for each release build in the top CMakeLists.txt file. So you could 
have something like:
 

 
Append project name allow option to override default name.
-
 
CPACK_PACKAGE_NAME - works the same as it does now to provide a name for the 
package.
 
For each build append the name of the release to the name. For example
 
CPACK_PACKAGE_NAME = "MyLib"
 
If I do "cpack -C Debug" then I get a package with the name
 
MyLib-0.0.1-win32-Debug.exe
 
Now if I provide a  CPACK_PACKAGE_NAME_APPENDIX_ then use the provided 
string as an appendix to the package name. If this is not present then use the 
default name.
 
Therefore if I provide:
 
CPACK_PACKAGE_NAME_APPENDIX_DEBUG = "dbg"
 
I would get
 
MyLib-0.0.1-win32-dbg.exe 
 
if I did the same cpack command above.
 
Its an idea. This way you could write a script to build all the package types 
you want from the command line.
 
Stephen
___
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] dependency problem

2010-06-08 Thread Yifei Li
Thank you for reply.

I already tried that.  I think the problem was caused by 'find_library' in my 
plugin's CMakeLists.txt, because it failed to find MyLib

I use a variable to hold the result of 'find_library'  and that variable is in 
turn used in target_link_libraries


Yifei
On Jun 8, 2010, at 3:57 PM, Torri, Stephen CIV NSWCDD, W15 wrote:

>> From: cmake-boun...@cmake.org on behalf of Yifei Li
>> Sent: Tue 6/8/2010 3:23 PM
>> To: cmake@cmake.org
>> Subject: [CMake] dependency problem
>> 
>> Hi folks,
>> 
>> I'm new to cmake, can anyone help me with the following situation:
>> 
>> I have a project which will generate following targets:  1) the application 
>> and a shared library, say MyLib.  2) some 
>> plugins(which are also shared libraries) that need to link MyLib, each 
>> plugin has its own cmakelists.txt
>> 
>> The problem is when CMakeLists.txt for a plugin is parsed, MyLib does not 
>> exist.
>> 
>> What is the correct way to handle this situation?
> 
> So the plugin depends on MyLib. I would look at adding a add_dependcies to 
> the plugin CMakeLists.txt.
> 
> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_dependencies
> 
> Stephen
> 
> ___
> 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] dependency problem

2010-06-08 Thread Torri, Stephen CIV NSWCDD, W15
> From: cmake-boun...@cmake.org on behalf of Yifei Li
> Sent: Tue 6/8/2010 3:23 PM
> To: cmake@cmake.org
> Subject: [CMake] dependency problem
> 
> Hi folks,
> 
> I'm new to cmake, can anyone help me with the following situation:
> 
>  I have a project which will generate following targets:  1) the application 
> and a shared library, say MyLib.  2) some 
> plugins(which are also shared libraries) that need to link MyLib, each plugin 
> has its own cmakelists.txt
> 
> The problem is when CMakeLists.txt for a plugin is parsed, MyLib does not 
> exist.
> 
> What is the correct way to handle this situation?

So the plugin depends on MyLib. I would look at adding a add_dependcies to the 
plugin CMakeLists.txt.

http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_dependencies

Stephen

___
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] Building multiple releases for a visual studio project

2010-06-08 Thread John Drescher
On Tue, Jun 8, 2010 at 2:52 PM, Torri, Stephen CIV NSWCDD, W15
 wrote:
> I was wondering if it was possible to have a CMake project that builds a 
> Microsoft Visual Studio Project produce an NSIS installer for each kind of 
> build (e.g. debug, release, RelWithDebug). Right now I can build the project 
> via Visual Studio for all the build types which is great. Now I would like to 
> have one NSIS installer for each type. Is that possible?
>

Copy the package then switch the build type in visual studio and then
run package. The file overwrites the previous nsis package with the
same name but I am pretty sure it builds for the current
configuration.

John
___
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] dependency problem

2010-06-08 Thread Yifei Li
Hi folks,

I'm new to cmake, can anyone help me with the following situation:

I have a project which will generate following targets:  1) the application and 
a shared library, say MyLib.  2) some plugins(which are also shared libraries) 
that need to link MyLib, each plugin has its own cmakelists.txt

The problem is when CMakeLists.txt for a plugin is parsed, MyLib does not exist.

What is the correct way to handle this situation?

Thanks

Yifei 
___
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] decision based on being a nested project

2010-06-08 Thread Nathan Huesken
Hi,

As can be read in an earlier thread, I am trying to nest a cmake
project (call it "inner") into another cmake project (call it "outer").
The "inner" project should be extracable and run as its own project.

Having trouble with EXTERNALPROJECT_ADD, I am trying to add the project
as a subdir. So I have something like this:
- rootdir
  CMakeFile: Project(outer)
  - lib
CMakeFile: Add_Subdirectory(inner)
- inner
  CMakeFile: Project(inner)
  - doc
CMakeFile: Add_target(doc)
  - doc
CMakeFile: Add_target(doc)
...

The problem now is, that the target "doc" exists twice, cmake
complaints.

So I would rename the inner target to "inner_doc", and add it as a
dependency of "doc".
But as said the inner project should also work on is own.
So I would do:

IF_IS_NESTED_PROJECT
  add_target(inner_doc)
ELSE
  add_target(doc)
ENDIF

My question: How can I find out if inner is configured as inner project
of outer or as a standalone project? (How can I do the
IF_IS_NESTED_PROJECT)?

Thanks!
Nathan
___
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] Building multiple releases for a visual studio project

2010-06-08 Thread Torri, Stephen CIV NSWCDD, W15
I was wondering if it was possible to have a CMake project that builds a 
Microsoft Visual Studio Project produce an NSIS installer for each kind of 
build (e.g. debug, release, RelWithDebug). Right now I can build the project 
via Visual Studio for all the build types which is great. Now I would like to 
have one NSIS installer for each type. Is that possible?
 
Stephen
 
___
Powered by www.kitware.com

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

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

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


[CMake] CMake with (VCExpress & Intel Ifort 2008)

2010-06-08 Thread Giraudon Cyril

 Hello,

I try to compile the next version of HDF5 project which can be 
generated/compiled with CMake.


I use Visual Studio Express 9 2008 and ifort 11.1 under Windows XP.


Generation without Fortran binding :
After modifying the CMAKE_MAKE_PROGRAM from
devcom.com
to
VCExpress.exe
The configure operation succeeds, I choose a mingw makefile and I can 
generate binaries, dll ...




When I try to generate the fortran binding the reported message 
(hereafter) is printed.


It seems CMake can't deal with the couple (Visual Studio Express 2008, 
Ifort 11.1).


Do I something wrong ?
Is there anything to do to fix the problem ?

Thanks a lot,

Regards,

Cyril Giraudon.


"""
Configure Checks that still need to be implemented

GetConsoleScreenBufferInfo function for Windows

The Fortran compiler identification is unknown

Check for working Fortran compiler: C:/Program 
Files/Intel/Compiler/11.1/060/bin/ia32/ifort.exe


Check for working Fortran compiler: C:/Program 
Files/Intel/Compiler/11.1/060/bin/ia32/ifort.exe -- broken


CMake Error at C:/Program Files/CMake 
2.8/share/cmake-2.8/Modules/CMakeTestFortranCompiler.cmake:40 (MESSAGE):


The Fortran compiler "C:/Program

Files/Intel/Compiler/11.1/060/bin/ia32/ifort.exe" is not able to compile a

simple test program.

It fails with the following output:

Change Dir: 
C:/dev/outils/hdf5/hdf5-1.8.5-pre2.tar/hdf5-1.8.5-pre2/build/CMakeFiles/CMakeTmp


Run Build Command:C:/dev/programs/MinGW/bin/mingw32-make.exe

"cmTryCompileExec/fast"

C:/dev/programs/MinGW/bin/mingw32-make.exe -f

CMakeFiles\cmTryCompileExec.dir\build.make

CMakeFiles/cmTryCompileExec.dir/build

mingw32-make.exe[1]: Entering directory

`C:/dev/outils/hdf5/hdf5-1.8.5-pre2.tar/hdf5-1.8.5-pre2/build/CMakeFiles/CMakeTmp'

"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_report

C:\dev\outils\hdf5\hdf5-1.8.5-pre2.tar\hdf5-1.8.5-pre2\build\CMakeFiles\CMakeTmp\CMakeFiles

1

Building Fortran object

CMakeFiles/cmTryCompileExec.dir/testFortranCompiler.f.obj

C:\PROGRA~1\Intel\Compiler\11.1\060\bin\ia32\ifort.exe /nologo /fpp

/FoCMakeFiles\cmTryCompileExec.dir\testFortranCompiler.f.obj /debug:full

/dbglibs -c

C:\dev\outils\hdf5\hdf5-1.8.5-pre2.tar\hdf5-1.8.5-pre2\build\CMakeFiles\CMakeTmp\testFortranCompiler.f

Linking Fortran executable cmTryCompileExec.exe

"C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_link_script

CMakeFiles\cmTryCompileExec.dir\link.txt --verbose=1

C:\PROGRA~1\Intel\Compiler\11.1\060\bin\ia32\ifort.exe /nologo

@CMakeFiles\cmTryCompileExec.dir\objects1.rsp /debug:full /dbglibs

/FecmTryCompileExec.exe -link /implib:cmTryCompileExec.lib /INCREMENTAL:YES

/debug /subsystem:console user32.lib

LINK : fatal error LNK1104: impossible d'ouvrir le fichier 'ifconsol.lib'

mingw32-make.exe[1]: *** [cmTryCompileExec.exe] Error 1104

mingw32-make.exe[1]: Leaving directory

`C:/dev/outils/hdf5/hdf5-1.8.5-pre2.tar/hdf5-1.8.5-pre2/build/CMakeFiles/CMakeTmp'

mingw32-make.exe: *** [cmTryCompileExec/fast] Error 2

CMake will not be able to correctly generate this project.

Call Stack (most recent call first):

fortran/CMakeLists.txt:2 (PROJECT)

Configuring incomplete, errors occurred!

"""

___
Powered by www.kitware.com

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

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

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

Re: [CMake] cmake-2.8.1 cygwin on win7 64

2010-06-08 Thread Bill Hoffman

On 6/8/2010 11:03 AM, Dr DB Karron wrote:

I have a full cigwin installed on Windows 7 64 bit;
java and curses all default installed.

./bootstrap is failing.
./configure is failing

Here is the log.



Works for me... :)

What is in this file:
Bootstrap.cmk/cmake_bootstrap.log

Not finding java should not be a fatal error.

Try starting from a clean source tree and do this:

mkdir build
cd build
../CMake/bootstrap >& output

then send output and
Bootstrap.cmk/cmake_bootstrap.log  back to the list unless you find out 
what went wrong.


-Bill
___
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 see the generated compiler commands?

2010-06-08 Thread Torri, Stephen CIV NSWCDD, W15
> From: cmake-boun...@cmake.org on behalf of Felipe Sodré Silva
> Sent: Tue 6/8/2010 12:43 PM
> To: cmake@cmake.org
> Subject: [CMake] How to see the generated compiler commands?
> 
> 
> Hi, I wrote a cmake script that generates a unix makefile for a project, and 
> I'd like to know if there's an easy 
> way to see the compiler arguments the make system is using to build the 
> project. Looking at the generated 
> Makefile doesn't seem to be an option.

Yes there is. To see what is being done do the following:
 
make VERBOSE=1
 
Stephen
___
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 see the generated compiler commands?

2010-06-08 Thread Felipe Sodré Silva
Hi, I wrote a cmake script that generates a unix makefile for a project, and
I'd like to know if there's an easy way to see the compiler arguments the
make system is using to build the project. Looking at the generated Makefile
doesn't seem to be an option.

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

[CMake] CPack: debugging project.nsi file - unknown variable

2010-06-08 Thread Torri, Stephen CIV NSWCDD, W15
Now that I have a libraries being linked in correctly its time to move to using 
CPack. The cpack utility failed to execute "makensis.exe project.nsi". When I 
looked in the NSISOutput.log I see a few warnings:
 
warning: unknown variable/constant "{headers}" detected, ignoring 
(macro:Deselect_required_by_libraries:1)
warning: unknown variable/constant "{headers}" detected, ignoring 
(macro:Deselect_required_by_libraries:4)
 
Followed by some errors:
 

Error in macro Deselect_required_by_libraries on macroline 5

Error in macro MaybeSelectionChanged on macroline 10

Error in macro SectionList on macroline 3

Error in script "project.nsi" on line 831 -- aborting creation 
process

After look at the script I found the first offending macro:

!macro Deselect_required_by_libraries
  SectionGetFlags ${headers} $0
  IntOp $1 ${SF_SELECTED} ~
  IntOp $0 $0 & $1
  SectionSetFlags ${headers} $0
  IntOp $headers_selected 0 + 0
!macroend 

I must have failed to set something up in either the project CMakeLists.txt 
file or a child project. Where is ${headers} defined? In my project's 
CMakeLists.txt files I typically grouped my headers by:

FILE (GLOB HEADERS *.h)

Which then I used that variable in the file as:

add_library ( child ${SOURCE} ${HEADERS} )

INSTALL ( FILES ${HEADERS} DESTINATION include/${PROJECT_NAME}/child )

The INSTALL line was written for Linux so I will have to change that for 
Windows. I would want the headers to be installed in the installation directory 
on Windows like:

C:\Program Files\Project\include

I am not sure what files are best to send to help debug this problem.

Stephen 

 
Stephen Torri, PhD
NAVAL SURFACE WARFARE CENTER DAHLGREN
17214 Ave B Suite 121
Dahlgren, Va. 22448
540-653-1082
I am not a contracting officer.  I cannot modify or initiate contracts, nor do 
I have the authority to financially commit the government in any way.
___
Powered by www.kitware.com

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

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

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


[CMake] cmake-2.8.1 cygwin on win7 64

2010-06-08 Thread Dr DB Karron
I have a full cigwin installed on Windows 7 64 bit;
java and curses all default installed.

./bootstrap is failing.
./configure is failing

Here is the log.


"Dr D B Karron" 

+1 (917) 674-0828 (voice and cell texting)


err_log
Description: Binary data
___
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] Different configurations for Debug and Release

2010-06-08 Thread David Cole
On Tue, Jun 8, 2010 at 10:00 AM, Torri, Stephen CIV NSWCDD, W15 <
stephen.to...@navy.mil> wrote:

> > From: Michael Wild [mailto:them...@gmail.com]
> > Sent: Tue 6/8/2010 9:05 AM
> > To: Torri, Stephen CIV NSWCDD, W15
> > Cc: cmake@cmake.org
> > Subject: Re: [CMake] Different configurations for Debug and Release
> >
> >
> > > In my project the external libraries I use have the debug library files
> are in a different directory from the release versions. > > I don't think I
> can use target_link_libraries to include a path as well as the name. In
> documentation I would use > > link_directories but there is no way in the
> syntax to distinguish a debug directory from a release directory. I am
> trying > > to generate a Visual Studio project that can build a debug
> release if I select "Debug" in the configuration manager drop > > down menu
> or "Release". Is there a way for me to tell CMake that a certain set of
> directories the linker should use to > > search for files for the debug
> build versus another?
> > >
> > > Stephen
> > >
> >
> > Either use
> >
> > target_link_libraries( debug  optimized 
> general )
> >
> > or, for more control, create an imported library
> (add_library( IMPORTED)) and set the >
> IMPORTED_LOCATION_ target properties to specify the location on the
> disk for each of the configurations > you want to handle.
>
> I did not think that I could use a full path to a library in the
> TARGET_LINK_LIBRARIES. Is that right?


No, that is not right. On the contrary: we recommend that you use full paths
to libraries in target_link_libraries calls.



> I don't think what you suggest will work:
>
> TARGET_LINK_LIBRARIES (   ${Boost_LIBRARIES}
>${MYSQLCPPCONNECTOR_LIB_DIR}/debug/mysqlcppconn-static.lib )
>

This should work. Do you have a problem with it if you try it?

You can add debug and optimized versions like this (if those libraries
exist):

TARGET_LINK_LIBRARIES (   ${Boost_LIBRARIES}
   debug ${MYSQLCPPCONNECTOR_LIB_DIR}/debug/mysqlcppconn-static.lib
   optimized
${MYSQLCPPCONNECTOR_LIB_DIR}/release/mysqlcppconn-static.lib )

Then, in multi-configuration generators (VS and Xcode), CMake links debug to
debug and release to release... Or in a makefile based build, the value of
CMAKE_BUILD_TYPE is used to determine which libraries to link to.


HTH,
David



> So I was looking at add_library. I am not sure I get the
> IMPORTED_LOCATION_. First off what can I use for ? I tried
> IMPORTED_LOCATION_DEBUG but that gave me an error from cmake-gui saying its
> was an unknown cmake command. The documentation does not clearly define what
>  is other than stating its a configuration. Can you provide a simple
> example of what you are suggesting?
>
> Stephen
>
>
> ___
> 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] Different configurations for Debug and Release

2010-06-08 Thread Torri, Stephen CIV NSWCDD, W15
> From: Michael Wild [mailto:them...@gmail.com]
> Sent: Tue 6/8/2010 9:05 AM
> To: Torri, Stephen CIV NSWCDD, W15
> Cc: cmake@cmake.org
> Subject: Re: [CMake] Different configurations for Debug and Release
> 
> 
> > In my project the external libraries I use have the debug library files are 
> > in a different directory from the release versions. > > I don't think I can 
> > use target_link_libraries to include a path as well as the name. In 
> > documentation I would use > > link_directories but there is no way in the 
> > syntax to distinguish a debug directory from a release directory. I am 
> > trying > > to generate a Visual Studio project that can build a debug 
> > release if I select "Debug" in the configuration manager drop > > down menu 
> > or "Release". Is there a way for me to tell CMake that a certain set of 
> > directories the linker should use to > > search for files for the debug 
> > build versus another?
> >
> > Stephen
> >
> 
> Either use
> 
> target_link_libraries( debug  optimized  general 
> )
> 
> or, for more control, create an imported library (add_library( 
> IMPORTED)) and set the > IMPORTED_LOCATION_ target properties to 
> specify the location on the disk for each of the configurations > you want to 
> handle.

I did not think that I could use a full path to a library in the 
TARGET_LINK_LIBRARIES. Is that right? I don't think what you suggest will work:
 
 TARGET_LINK_LIBRARIES (   ${Boost_LIBRARIES}
${MYSQLCPPCONNECTOR_LIB_DIR}/debug/mysqlcppconn-static.lib )
 
So I was looking at add_library. I am not sure I get the 
IMPORTED_LOCATION_. First off what can I use for ? I tried 
IMPORTED_LOCATION_DEBUG but that gave me an error from cmake-gui saying its was 
an unknown cmake command. The documentation does not clearly define what 
 is other than stating its a configuration. Can you provide a simple 
example of what you are suggesting?
 
Stephen
 
 
___
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: Any way around the "one test == one program invocation" assumption?

2010-06-08 Thread Biddiscombe, John A.


All in all it'd be much nicer if there was some kind of hook in ctest which 
could be used to inform it that a number of tests had been run, and let it 
populate and submit the XML report based on that information. But, if there's 
any way to do that, it's highly undocumented...



It doesn't appear like there is a class for storing the test results before 
serializing the XML document to a file.  Sounds like that's what would have to 
be written.





cmCTestTestHandler::GenerateDartOutput

Looks like it may be a place to start?





Alternatively, how about making the custom test return a simple XML which had



  name

  pass/fail

  < full test text output>

/>



  name

  pass/fail

  

/>

... /etc/etc

and then add a function into cmCtestHandler to parse the result - in the fixed 
form you define - back into a standard Dart compatible form which it then 
submits as usual. A slight modification of ADD_TEST to trigger the new form of 
output would probably be enough.



JB


___
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] Different configurations for Debug and Release

2010-06-08 Thread Michael Wild

On 8. Jun, 2010, at 14:45 , Torri, Stephen CIV NSWCDD, W15 wrote:

>> From: cmake-boun...@cmake.org on behalf of Tyler Roscoe
>> Sent: Mon 6/7/2010 4:25 PM
>> To: Felipe Sodré Silva
>> Cc: cmake@cmake.org
>> Subject: Re: [CMake] Different configurations for Debug and Release
>> 
>>> On Mon, Jun 07, 2010 at 03:04:02PM -0300, Felipe Sodré Silva wrote:
>>> The CXX_FLAGS part seems to work (I needed the LINK_FLAGS_RELEASE), but I
>>> also need to include a library (through target_link_libraries) if and only
>>> if I am building a release version. Is that possible?
>> 
>> Look at the debug and optimized flags for target_link_libraries().
> 
> In my project the external libraries I use have the debug library files are 
> in a different directory from the release versions. I don't think I can use 
> target_link_libraries to include a path as well as the name. In documentation 
> I would use link_directories but there is no way in the syntax to distinguish 
> a debug directory from a release directory. I am trying to generate a Visual 
> Studio project that can build a debug release if I select "Debug" in the 
> configuration manager drop down menu or "Release". Is there a way for me to 
> tell CMake that a certain set of directories the linker should use to search 
> for files for the debug build versus another?
> 
> Stephen 
> 

Either use

target_link_libraries( debug  optimized  general 
)

or, for more control, create an imported library (add_library( 
IMPORTED)) and set the IMPORTED_LOCATION_ target properties to specify 
the location on the disk for each of the configurations you want to handle.

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] Different configurations for Debug and Release

2010-06-08 Thread Torri, Stephen CIV NSWCDD, W15
> From: cmake-boun...@cmake.org on behalf of Tyler Roscoe
> Sent: Mon 6/7/2010 4:25 PM
> To: Felipe Sodré Silva
> Cc: cmake@cmake.org
> Subject: Re: [CMake] Different configurations for Debug and Release
> 
> > On Mon, Jun 07, 2010 at 03:04:02PM -0300, Felipe Sodré Silva wrote:
> > The CXX_FLAGS part seems to work (I needed the LINK_FLAGS_RELEASE), but I
> > also need to include a library (through target_link_libraries) if and only
> > if I am building a release version. Is that possible?
> 
> Look at the debug and optimized flags for target_link_libraries().

In my project the external libraries I use have the debug library files are in 
a different directory from the release versions. I don't think I can use 
target_link_libraries to include a path as well as the name. In documentation I 
would use link_directories but there is no way in the syntax to distinguish a 
debug directory from a release directory. I am trying to generate a Visual 
Studio project that can build a debug release if I select "Debug" in the 
configuration manager drop down menu or "Release". Is there a way for me to 
tell CMake that a certain set of directories the linker should use to search 
for files for the debug build versus another?
 
Stephen 


___
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 doesn't add the -lpthread option

2010-06-08 Thread Ryan Pavlik

On 6/8/10 3:54 AM, Cadio Nicolas (Creative Ingenierie) wrote:


Hi,

I work on a C/C++ project where we use the library POSIX thread (pthread).

We use two compiler (x86_64-redhat-linux and x86_64-unknown-linux-gnu).

When I compile the project with the redhat compiler, cmake adds 
automatically the option --lpthread to the command line of the 
compilation


BUT when I use the unknown compiler, cmake doesn't add this option.

I don't understand why cmake doesn't add the --lpthread option with 
the x86_64-unknown-linux-gnu.


Anybody can help me please to resolve my problem ?

Thanks, nico

Are you using the find_package(Threads) command to find the library 
required for threads?  You should not depend on the compiler to 
automatically add that option - if you want threads, use the find module.


Ryan

--
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.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] CTest: Any way around the "one test == one program invocation" assumption?

2010-06-08 Thread Philip Lowman
On Tue, Jun 8, 2010 at 4:32 AM, Chris Hillery wrote:

> On Tue, Jun 8, 2010 at 1:00 AM, Biddiscombe, John A. wrote:
>
>> I'm sure someone has a better answer ... but ...
>>
>> > I have complete control over the test
>> > program and can make it output whatever I want.
>>
>> Have a look at the XML produced by ctest itself and generate it yourself?
>> then submit it and you should see each test separately
>>
>> (Just thinking out loud)
>>
>
> Yeah, worst case I'll head down that path. It's a hairy path though. For
> instance, I'd still definitely want to run "normal" ctest tests as well,
> which means the XML would need to be merged in some fashion. Also, it seems
> like doing it that way opens you up to possible problems later if ctest or
> cdash change the XML format at all.
>
> All in all it'd be much nicer if there was some kind of hook in ctest which
> could be used to inform it that a number of tests had been run, and let it
> populate and submit the XML report based on that information. But, if
> there's any way to do that, it's highly undocumented...
>

It doesn't appear like there is a class for storing the test results before
serializing the XML document to a file.  Sounds like that's what would have
to be written.

cmCTestTestHandler::GenerateDartOutput
Looks like it may be a place to start?

-- 
Philip Lowman
___
Powered by www.kitware.com

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

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

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

[CMake] Cmake doesn't add the -lpthread option

2010-06-08 Thread Cadio Nicolas (Creative Ingenierie)
Hi,

 

I work on a C/C++ project where we use the library POSIX thread
(pthread).

We use two compiler (x86_64-redhat-linux and x86_64-unknown-linux-gnu).

 

When I compile the project with the redhat compiler, cmake adds
automatically the option -lpthread to the command line of the
compilation 

 

BUT when I use the unknown compiler, cmake doesn't add this option.

 

I don't understand why cmake doesn't add the -lpthread option with the
x86_64-unknown-linux-gnu.

 

Anybody can help me please to resolve my problem ?

 

Thanks, nico

___
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: Any way around the "one test == one program invocation" assumption?

2010-06-08 Thread Chris Hillery
On Tue, Jun 8, 2010 at 1:00 AM, Biddiscombe, John A. wrote:

> I'm sure someone has a better answer ... but ...
>
> > I have complete control over the test
> > program and can make it output whatever I want.
>
> Have a look at the XML produced by ctest itself and generate it yourself?
> then submit it and you should see each test separately
>
> (Just thinking out loud)
>

Yeah, worst case I'll head down that path. It's a hairy path though. For
instance, I'd still definitely want to run "normal" ctest tests as well,
which means the XML would need to be merged in some fashion. Also, it seems
like doing it that way opens you up to possible problems later if ctest or
cdash change the XML format at all.

All in all it'd be much nicer if there was some kind of hook in ctest which
could be used to inform it that a number of tests had been run, and let it
populate and submit the XML report based on that information. But, if
there's any way to do that, it's highly undocumented...

Ceej
aka Chris Hillery
___
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: Any way around the "one test == one program invocation" assumption?

2010-06-08 Thread Biddiscombe, John A.
I'm sure someone has a better answer ... but ...

> I have complete control over the test
> program and can make it output whatever I want.

Have a look at the XML produced by ctest itself and generate it yourself? then 
submit it and you should see each test separately

(Just thinking out loud)

JB


-- 
John Biddiscombe,    email:biddisco @ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland  | Fax:  +41 (91) 610.82.82



___
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