[CMake] how to write a cmakelist to call a function in another c or cxx file

2010-01-16 Thread Yixun Liu
Hi, I am not familiar with writing CMakelist. I have a simple cmakelist file as following. # This project is designed to be built outside the Insight source tree. PROJECT(main) # Find ITK. FIND_PACKAGE(ITK REQUIRED) IF(ITK_FOUND) INCLUDE(${ITK_USE_FILE}) ENDIF(ITK_FOUND) FIND_PACKAGE(VTK REQUI

[CMake] FindGTest patch

2010-01-16 Thread Stephan Menzel
Hi, please correct me if I'm wrong but in my impression the existing FindGTest module is rather ignorant about finding 64 bit builds on windows. It also doesn't handle Debug/Release linking very well. Also it appears not to be quite consistent with it's API description. Please find a patch attache

Re: [CMake] how to write a cmakelist to call a function in another c or cxx file

2010-01-16 Thread C. Meissa
Hello Liu, > However, after ccmake and then make, I got the error: > main.cxx:(.text+0x10a): undefined reference to `func()' > collect2: ld returned 1 exit status Can you put SET (CMAKE_VERBOSE_MAKEFILE TRUE) to your CMakeLists.txt to check what compiler command is run? bye C.M.

Re: [CMake] Proposal for new generator options

2010-01-16 Thread Jochen Wilhelmy
Hi! the first solution (Manual Replace) in http://www.itk.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F does not seem to work since in the gui of cmake (2.6 for windows) I don't see any CMAKE_C_FLAGS_DEBUG etc. to modify. the project (svn repository) is http:/

[CMake] Set directory path in release mode

2010-01-16 Thread Arturo Caissut
Hi all, I have a little problem with a C++ project I'm writing using CMake features. I need to define two constants in one of the header files of my projects, I found a solution for this reading "Mastering CMake". As they suggest I wrote a config.h.in file with pre-compiler instructions: |#define

Re: [CMake] Proposal for new generator options

2010-01-16 Thread John Drescher
On Sat, Jan 16, 2010 at 11:07 AM, Jochen Wilhelmy wrote: > Hi! > > the first solution (Manual Replace) in > http://www.itk.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F > > does not seem to work since in the gui of cmake (2.6 for windows) I don't > see > any CMAKE

Re: [CMake] Set directory path in release mode

2010-01-16 Thread Michael Wild
On 16. Jan, 2010, at 17:02 , Arturo Caissut wrote: > Hi all, > I have a little problem with a C++ project I'm writing using CMake features. > I need to define two constants in one of the header files of my > projects, I found a solution for this reading "Mastering CMake". As they > suggest I wrot

Re: [CMake] Proposal for new generator options

2010-01-16 Thread Jochen Wilhelmy
Also you should upgrade to cmake-2.8.0 if possible. It has many improvements over 2.6.X Now it works, I have upgraded to 2.8.0 and switched to "Advanced View". Since I have to start the tool, change it for debug and release and then re-generate I still think it could be done easier, especi

Re: [CMake] Proposal for new generator options

2010-01-16 Thread John Drescher
> Now it works, I have upgraded to 2.8.0 and switched to "Advanced View". > Since I have to start the tool, change it for debug and release and then > re-generate > I still think it could be done easier, especially without needing to ask in > this mailing list. > How do all these dummy windows user

Re: [CMake] Set directory path in release mode

2010-01-16 Thread Arturo Caissut
So I should do it in my code instead of trying a CMake based solution, like with a file attributes check. Thank you very much, Arturo Michael Wild wrote: > Usually one configures such config.h files for the installation paths, not > the build directory. For my programs I do it like this to find

Re: [CMake] Set directory path in release mode

2010-01-16 Thread Tyler Roscoe
On Sat, Jan 16, 2010 at 05:02:32PM +0100, Arturo Caissut wrote: > suggest I wrote a config.h.in file with pre-compiler instructions: > > |#define ATLAS_TXT_PATH "@ATLAS_TXT_PATH@" > #define ATLAS_HDR_PATH "@ATLAS_HDR_PATH@" > | > and I added to my CMakeLists.txt file the following lines: > > |set

Re: [CMake] Set directory path in release mode

2010-01-16 Thread Arturo Caissut
This is in fact a Visual Studio project (and I hate this, but I'll have to live with it just for a little while). The problem is that the program will search for two data files in the path set during building time, instead of searching them where they are installed. No compiling errors, just a runt

Re: [CMake] how to write a cmakelist to call a function in another c or cxx file

2010-01-16 Thread Hendrik Sattler
Am Samstag 16 Januar 2010 15:40:55 schrieb Yixun Liu: > ADD_EXECUTABLE(main main.cxx ) > > TARGET_LINK_LIBRARIES(main ITKCommon ITKIO vtkCommon vtkIO ) > > It works well. > Now I need to ,in main.cxx, invoke a function, let's say func(), > defined in another c file, let's say test.c. You need

Re: [CMake] how to write a cmakelist to call a function in another c or cxx file

2010-01-16 Thread Yixun Liu
I do add test.c (see previous email). If I change test.c to test.cxx, it works. I do not know why. Hendrik Sattler wrote: > Am Samstag 16 Januar 2010 15:40:55 schrieb Yixun Liu: > >> ADD_EXECUTABLE(main main.cxx ) >> >> TARGET_LINK_LIBRARIES(main ITKCommon ITKIO vtkCommon vtkIO ) >> >> It work

Re: [CMake] how to write a cmakelist to call a function in another c or cxx file

2010-01-16 Thread Stephan Menzel
I guess it would be a C linkage problem then. Have you got extern "C" {} around the exported symbols? Cheers, Stephan On Sat, Jan 16, 2010 at 7:21 PM, Yixun Liu wrote: > I do add test.c (see previous email). > If I change test.c to test.cxx, it works. I do not know why. > __

[CMake] Question about dependencies for install (FILES...)

2010-01-16 Thread Christoph Cullmann
Hi, I try to install a flex generated file: (lex.loopmap_.cpp) CMakeLists.txt excerpt: set (cfg_cfiles_install files conmap.cpp loopmap.cpp regmap.cpp mapping.cpp lex.loopmap_.cpp paggdl.cpp scc.cpp sort.cpp sort_exp

Re: [CMake] Question about dependencies for install (FILES...)

2010-01-16 Thread Alexander Neundorf
On Saturday 16 January 2010, Christoph Cullmann wrote: > Hi, > > I try to install a flex generated file: (lex.loopmap_.cpp) > > CMakeLists.txt excerpt: > > set (cfg_cfiles_install > files > conmap.cpp > loopmap.cpp > regmap.cpp > mapping.cpp > lex.loo

[CMake] Three newbie questions: default build type, find_package-modules, default compiler flags

2010-01-16 Thread Michael Roth
Hello, I'm a cmake newbie and have three questions: a.) What is the best way to set a default build type? Currently I do something like this: if (NOT CMAKE_BUILD_TYPE) message(STATUS "No build type selected, default to Release") set(CMAKE_BUILD_TYPE "R

Re: [CMake] Three newbie questions: default build type, find_package-modules, default compiler flags

2010-01-16 Thread Alexander Neundorf
On Saturday 16 January 2010, Michael Roth wrote: > Hello, > > I'm a cmake newbie and have three questions: > > a.) What is the best way to set a default build type? Currently I > do something like this: > > if (NOT CMAKE_BUILD_TYPE) > message(STATUS "No build type selected,

[CMake] How to refer to current configuration?

2010-01-16 Thread Timothy Reaves
I have a project that produces a dynamic library. This gets built to a directory that in the src tree. Specifically, it is put in a subdirectory of src that is the same as the name of the active configuration. So if I am building a debug release, the path is src/Debug/my.dylib, and fo

Re: [CMake] Proposal for new generator options

2010-01-16 Thread Jochen Wilhelmy
I would suspect that most users use the default values. I pretty much go with the defaults with the addition of adding the /MP parameter inside my main CMakeLists.txt file. If you are the author of some software then this is fine. But I have the case where I have to use some existing visual st

Re: [CMake] how to write a cmakelist to call a function in another c or cxx file

2010-01-16 Thread Hendrik Sattler
Am Samstag 16 Januar 2010 19:21:42 schrieb Yixun Liu: > I do add test.c (see previous email). > If I change test.c to test.cxx, it works. I do not know why. Hint: C++ name mangling. Add a test.h: extern "C" { void func(); } and include it in your main.cxx file. Alternatively, set the LANGUAGE

Re: [CMake] Proposal for new generator options

2010-01-16 Thread John Drescher
On Sat, Jan 16, 2010 at 4:11 PM, Jochen Wilhelmy wrote: > >> I would suspect that most users use the default values. I pretty much >> go with the defaults with the addition of adding the /MP parameter >> inside my main CMakeLists.txt file. > > If you are the author of some software then this is fi

Re: [CMake] Proposal for new generator options

2010-01-16 Thread Clinton Stimpson
On 01/16/2010 02:11 PM, Jochen Wilhelmy wrote: I would suspect that most users use the default values. I pretty much go with the defaults with the addition of adding the /MP parameter inside my main CMakeLists.txt file. If you are the author of some software then this is fine. But I have the

Re: [CMake] Proposal for new generator options

2010-01-16 Thread Jochen Wilhelmy
You may be able to get this approved if you file a bug report and possibly provide a patch for this. It actually should not be that hard to implement however I assume developers have much higher priorities than this. ok, is there a svn where I can check out directly? I at least can have a lo

Re: [CMake] Proposal for new generator options

2010-01-16 Thread Jochen Wilhelmy
The generators are compiler and/or build system specific. In other words, none of the generators now have anything to do with compile flags. But what about Win32 and Win64? To visual studio this is only a setting (like a compiler flag). I would solve all "platform like" settings via generator

Re: [CMake] Proposal for new generator options

2010-01-16 Thread John Drescher
On Sat, Jan 16, 2010 at 6:58 PM, Jochen Wilhelmy wrote: > >> You may be able to get this approved if you file a bug report and >> possibly provide a patch for this. It actually should not be that hard >> to implement however I assume developers have much higher priorities >> than this. >> > > ok,

Re: [CMake] FindGTest patch

2010-01-16 Thread Philip Lowman
On Sat, Jan 16, 2010 at 10:16 AM, Stephan Menzel wrote: > please correct me if I'm wrong but in my impression the existing > FindGTest module is rather ignorant about finding 64 bit builds on > windows. It also doesn't handle Debug/Release linking very well. Also > it appears not to be quite consi