[CMake] SOLUTION to problem

2012-01-30 Thread Denis Scherbakov
Hi! I just wanted to share my solution to problem. As I alredy wrote: I have a big list of (say XML) files that executables expect to be in strictly predetermined locations. Also we need to test executables after install has been done. In other words, we need "gmake test" to depends on "gmake i

[CMake] How to "install" then "test"?

2011-12-29 Thread Denis Scherbakov
Dear All! Maybe someone can help me: I have a project, we compile binaries and then using various INSTALL directives finish the job by copying files where they belong: to "bin", "man", "libexec", etc. The point is, we need to run executables after they got installed into this tree, because otherw

Re: [CMake] Problems with parallel builds

2010-11-18 Thread Denis Scherbakov
oblem that I cannot compile my project in parallel. The question is: How to implement mutexes in CMake scripts? Denis --- On Thu, 11/18/10, David Cole wrote: > From: David Cole > Subject: Re: [CMake] Problems with parallel builds > To: "Denis Scherbakov" > Cc: cmake@cmak

Re: [CMake] Problems with parallel builds

2010-11-18 Thread Denis Scherbakov
uot;gmake -j4 targetA targetB" also fails. You need to "gmake -j4 targetA" and then "gamake -j4 targetB" to get correct results. Denis --- On Thu, 11/18/10, David Cole wrote: > From: David Cole > Subject: Re: [CMake] Problems with parallel builds > To: "De

Re: [CMake] Problems with parallel builds

2010-11-18 Thread Denis Scherbakov
Hi, David, I did as you suggested: ADD_CUSTOM_COMMAND(OUTPUT MyFile.hh ...) ADD_CUTSOM_TARGET(MyHeaders DEPENDS MyFile.hh) ADD_LIBRARY(MYLIB ${MYLIB_SRCS}) ADD_DEPENDENCIES(MYLIB MyHeaders) ADD_LIBRARY(MYLIBpic ${MYLIB_SRCS}) ADD_DEPENDENCIES(MYLIBpic MyHeaders) Didn't work. Target "MyHeader

Re: [CMake] Problems with parallel builds

2010-11-18 Thread Denis Scherbakov
Hi, Marcel, What I mean is that I have a huge source tree and many CMake files and there is a source file inside this tree that needs to be built two times, because there will be an executable using it (non-PIC) and a shared library (PIC). So I have to create two targets (say MYLIB and MYLIBpic

Re: [CMake] Problems with parallel builds

2010-11-18 Thread Denis Scherbakov
at the same time and there is no way to tell one of them that the file is being built by someone else already. Denis --- On Thu, 11/18/10, Eric Noulard wrote: > From: Eric Noulard > Subject: Re: [CMake] Problems with parallel builds > To: "Denis Scherbakov" > Cc: cmake

[CMake] Problems with parallel builds

2010-11-18 Thread Denis Scherbakov
Dear All, I am using CMake 2.8.1 on Linux x86. I have a project that needs to be built two times. One with -fPIC, the other - without. The project depends on header files that need to be generated by an external script. When I build this project with several parallel jobs (gmake -j5, for exampl

Re: [CMake] find_library questions

2010-08-04 Thread Denis Scherbakov
>> 1) Is it possible to retrieve the path where find_library found the library? E.g. so I can setup ..._LIBRARY_DIR correctly. Yes, see GET_FILENAME_COMPONENT. 2) Is it possible to disable the "lib" prefix that find_library always seems to prepend when searching? I have a library that is called "

Re: [CMake] Double linking / linking static libraries

2010-08-04 Thread Denis Scherbakov
>> * I also set link_directories to paths containing the libraries. This is wrong. LINK_DIRECTORIES should be a list of directories, where libraries might be located, but not the libraries itself. ___ Powered by www.kitware.com Visit other Ki

Re: [CMake] static Qt linking while building other DLLs

2010-08-03 Thread Denis Scherbakov
Hi! Please provide a build log with VERBOSE=1 and a sample CMakeLists.txt, where you have a problem. Denis > We have a problem in our cmake project, where cmake links all libraries > two times. This makes it impossible to link static libraries. > The libraries > appear only once in target_link_li

[CMake] CMake exclusive lock

2010-08-02 Thread Denis Scherbakov
Hi! I have a project, where for some targets I have a POST_BUILD rule, which adds some data about this target into a "central file". If I build a project with several threads sometimes I get errors, when both threads try to write into this "central file" at the same time. So I was wondering, if

Re: [CMake] How can I write cmake file for _mm_malloc?

2009-12-09 Thread Denis Scherbakov
Did you link necessary libraries with TARGET_LINK_LIBRARIES? Denis --- On Wed, 12/9/09, Water Lin wrote: > From: Water Lin > Subject: [CMake] How can I write cmake file for _mm_malloc? > To: cmake@cmake.org > Date: Wednesday, December 9, 2009, 1:51 AM > > I am a new guy for CMake tool and I

Re: [CMake] help using try_run with custom build type

2009-07-08 Thread Denis Scherbakov
> > It appears to fail because the compiler options do not > make it in when > > creating the executable ... is there something silly I > have missed? > > Also, I was wondering why TRY_RUN doesn't use the > default flags > > defined from CMAKE_BUILD_TYPE ? > Is this a bug or am I not using TRY_R

Re: [CMake] [New Module] FindHDF5.cmake

2009-07-07 Thread Denis Scherbakov
> I have written a find module that invokes the hdf5 wrapper > compiler to determine libraries and includes that are > necessary for clients of HDF5.  I tried to follow the > guidelines for formatting and naming set forth in the module > readme.  At the moment, the module has been tested on > Linu

Re: [CMake] One target being built several times during parallel build

2009-06-18 Thread Denis Scherbakov
> > Could you suggest, how to prevent users from trying to > compile two targets > > at a time? I think this is a MAJOR bug. > > Since no one has been motivated enough to address it in the > 9 year history > of the project I wouldn't consider it a showstopping > bug.  Besides, even > if one trie

Re: [CMake] One target being built several times during parallel build

2009-06-18 Thread Denis Scherbakov
>> 6. gmake -j5 mytest printf >> 7. I observe target PUTS being built 2 times and "Building CXX object >> puts/CMakeFiles/puts.dir/puts.cpp.o" 2 times. Also counter goes to 150%. > Your project looks fine. > I missed in your earlier post that you ran "gmake -j9 E1 E2 E3". > The problem is that t

Re: [CMake] Multiple toolchains

2009-06-18 Thread Denis Scherbakov
> There was some talk about this a while ago (and a patch > supplied here) > http://www.mail-archive.com/cmake@cmake.org/msg13572.html > > I'm a bit curios what happened after this and if the above > code is possible to achieve now days? I am also waiting for multiple toolchain support in one s

Re: [CMake] One target being built several times during parallel build

2009-06-16 Thread Denis Scherbakov
> > I have a project with three executables: > > > > E1 depends on lib A > > E2 depends on lib A > > E3 depends on lib A > > > > First A must be built, then E1, E2 and E3. > > I do "gmake -j9 E1 E2 E3" and I see that target "A" is > being built 3? times > > instead of just one. I also notice tha

[CMake] One target being built several times during parallel build

2009-06-16 Thread Denis Scherbakov
I have a project with three executables: E1 depends on lib A E2 depends on lib A E3 depends on lib A First A must be built, then E1, E2 and E3. I do "gmake -j9 E1 E2 E3" and I see that target "A" is being built 3? times instead of just one. I also notice that progress counter goes past 100%. So

[CMake] Multiple COMMANDs in EXECUTE_PROCESS

2009-06-16 Thread Denis Scherbakov
I have multiple commands specified in one EXECUTE_PROCESS call like: EXECUTE_PROCESS(COMMAND cmd1 ... COMMAND cmd2 ... COMMAND cmd3...) Can anybody tell me if these commands are executed sequentially or in parallel? Also what about ADD_CUSTOM_COMMAND, .. TARGET and so on? Denis __

Re: [CMake] FW: building a mixed language programm with CMake

2009-06-11 Thread Denis Scherbakov
> Great, now it works! > My CMakeLists.txt now looks like this: I would put everything in an executable, without an intermediate step with ADD_LIBRARY. When I tested my suggestions for you on my computer, they worked without any intermediate library. But you might have some other project in mind,

Re: [CMake] FW: building a mixed language programm with CMake

2009-06-10 Thread Denis Scherbakov
> $ nm test.o > U __gxx_personality_v0 > U hello1_ > T main > $ nm hello.o > U _gfortran_st_write > U _gfortran_st_write_done > U _gfortran_transfer_character > T hello1_ So you're calling Fortran from C. > /usr/bin/gfortran   -fPIC  > CMakeFiles/hi.dir/hello.o 

Re: [CMake] FW: building a mixed language programm with CMake

2009-06-10 Thread Denis Scherbakov
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../lib64/crt1.o: > In function `_start': > (.text+0x20): undefined reference to `main' Try to compile with VERBOSE option: make VERBOSE=1 this will show you, what GCC does. > The only library I tell CMake to link to is libgfortran.so. > What

Re: [CMake] FW: building a mixed language programm with CMake

2009-06-10 Thread Denis Scherbakov
> Thanks, that helped, but I still have troubles to set the > options right: > Compiling my code "manually", it takes the > following commands: > > gfortran -c hello.f90 > g++ -lgfortran hello.o test.cxx -o test Actually this should look like: gfortran -c hello.f90 g++ -c test.cxx g++ -lgfortran

Re: [CMake] FW: building a mixed language programm with CMake

2009-06-09 Thread Denis Scherbakov
> Hi everybody, > I´d like to build a mixed language programm with CMake, > more specifically, I have a C++ and a Fortran90 source file > I want to link: > tp500main.cxx and electro1.f90 Did you try the following? PROJECT(TEST Fortran) SET(TEST_SRCS tp500main.cxx electro1.f90 ) ADD_EXECUT

Re: [CMake] Precompiled Headers

2009-06-08 Thread Denis Scherbakov
> Apart from every compiler making this different (i. e. > different > parameters for each compilers), what are the difficulties > you see for > making this a first-class feature? My Windows coworkers > demand this > feature and I was thinking in implementing when I had a few > spare time > at wor

Re: [CMake] LINK : fatal error LNK1104: cannot open file 'z.lib'

2009-06-08 Thread Denis Scherbakov
> On Sat, Jun 06, 2009 at 07:43:00PM +0200, motes motes > wrote: > > Sorry for the confusion. My point was that when I > downloaded zlib for > > windows there was no file called 'z.lib'. I would like > to know if anyone > > knows where this z.lib file might be found. Compile it yourself? zLib is

Re: [CMake] Question about linking

2009-06-08 Thread Denis Scherbakov
> I am relatively newbie to CMake community. I have a > question and I would be thankful if anybody answers. I do > apologize in advance if my question is too naive. I have a > project created by Cmake. It produces an executable which is > linked to many shared and static libraries. I am wonderi

Re: [CMake] Using m4 as a additional preprocessor for C/C++

2009-06-05 Thread Denis Scherbakov
> Is it possible to set the preprocessing to all .m4 files > avoiding a > manual specification of list of files to processed? I don't know of such, but it does not mean that it does not exist. If your list of files changes all the time, you can use FILE(GLOB...) to find all *.m4 files to automat

Re: [CMake] Using m4 as a additional preprocessor for C/C++

2009-06-05 Thread Denis Scherbakov
> 'm4' outputs only on stdout and does not have an option to > specify the > output file. Please > suggest me a solution for this... I had a similar problem and also with a preprocessor. I ended up writing a CMake script like this: EXECUTE_PROCESS( COMMAND my-command "${VAR_IFILE}" RESULT_V

Re: [CMake] Using m4 as a additional preprocessor for C/C++

2009-06-05 Thread Denis Scherbakov
> I wanted to do some looping in macros which are not > possible in GNU > CPP. So, I wrote > macros in m4. I wish to pre-process all my C/C++ code with > m4 before > handing it over to > gcc. I did not find any direct way out for doing this in > cmake. Any > ideas how to do it with > cmake? Use

Re: [CMake] Convert unix c++ compiler flags to windows compiler flags?

2009-06-05 Thread Denis Scherbakov
> > SET(CMAKE_CXX_FLAGS > > "${CMAKE_CXX_FLAGS} -w -lX11 -Dcimg_use_xshm -lXext > -Dcimg_use_xrandr -lXrandr > > -O3 -fpermissive -march=nocona -m64 -ffast-math > -funroll-loops > -finline-functions") > > > > Any ideas on who I convert those to windows (Visual > Studio 2008) > flags? I think

Re: [CMake] Creating one Visual Studio solution for many configurations and platforms

2009-06-05 Thread Denis Scherbakov
> > ist it possible with cmake to generate one Visual > Studio solution file for many different combinations > > of configurations (Debug,Release) and platforms(win32, > x64). Not possible. This has been discussed recently. The reason is that tests are being executed for a specific platform and

Re: [CMake] Trouble with Variable in installation

2009-06-05 Thread Denis Scherbakov
> I tried to > add a target which do the cmake and define the variable like > that : > > add_custom_target(MyInstall COMMAND "cmake -DLANG=%LANG%") > add_dependencies(install MyInstall) > > but I can't add the dependency between the two targets. I think currently it is not possible to force

Re: [CMake] Trouble with Variable in installation

2009-06-05 Thread Denis Scherbakov
> “make install > Lang=en_US” and > in my CMakeLists.txt : install(FILES language/$ENV{Lang} > > My problem is that > the variable is replaced > when the cmake is called so when I call “make install > Lang=xx”, the You may try to do something of the following either: cmake -DLANG=en_US /path/t

[CMake] Why "install" target depends on "all"?

2009-05-26 Thread Denis Scherbakov
I have a huge project with many libs and executables, but not all of them need to be installed. I'd say that only 20% of them have INSTALL command. When I issue "gmake install" the rest (80%) gets built and then only those 20% get installed. I thought that "install" must contain only a list of

Re: [CMake] Abuse of find_package COMPONENTS, or not?

2009-05-20 Thread Denis Scherbakov
> What do you mean with like FindBoost did? Can you be a bit > more > specific? Like set(FFTW_DO_SOMETHING ON) find_package(FindeFFTW) If you say that your components are mutually exclusive, then I'd rather use a flag than a component name. But you're the author, so you decide. Denis

Re: [CMake] Abuse of find_package COMPONENTS, or not?

2009-05-20 Thread Denis Scherbakov
> Do you guys consider this a good or a bad idea? If you > think it's a bad > idea, do you have a suggestion how to do things > differently? I would do like FindBoost did. Denis ___ Powered by www.kitware.com Visit other Kitware open-source p

Re: [CMake] How to use FindPackageHandleStandardArgs

2009-05-14 Thread Denis Scherbakov
> What's the best way to proceed. Should I collect the names > of variables > used in the find_library() calls in a separate list > variable and use > that for find_package_handle_standard_args(), or should I > just handle > the REQUIRED and QUIET stuff myself in this case. Any > recommendations?

Re: [CMake] How to use FindPackageHandleStandardArgs

2009-05-14 Thread Denis Scherbakov
> Yes, that's right. But... > > The number of libraries I need to find depends on the > COMPONENTS that > were specified by the user in his CMakeLists.txt file. So I > cannot hard > code these variables as arguments to > find_package_handle_standard_args(). That's why I chose to > collect them >

Re: [CMake] Settings different compile options for diff. files in same folder..

2009-05-14 Thread Denis Scherbakov
> I have a folder in which there are 5 files > folder > ... > Out of these from 4th and 5th iam making a library if iam > working on windows else with the rest three iam building one > library for the folder. Does the follwoing work? SET (MAIN_SRCS   a1.c   a2.c   a3.c ) SET (ADD_SRC

Re: [CMake] How to use FindPackageHandleStandardArgs

2009-05-14 Thread Denis Scherbakov
> That's my case as well. I need to find more than one > library, and it's > an all or nothing situation. I mean, if any of the > libraries I'm > searching for is missing, the package as such cannot be > used. So, my > original question still stands: > How should I pass a list of libraries to >

Re: [CMake] How to use FindPackageHandleStandardArgs

2009-05-14 Thread Denis Scherbakov
> I stumbled on a problem with FindPackageHandleStandardArgs, > which > probably arises from my misunderstanding of how to properly > use it. In FIND_PACKAGE_HANDLE_STANDARD_ARGS I inlude only variables that must always be defined in order for a package to function. If some variable can be omit

Re: [CMake] Generated source file dependencies

2009-05-13 Thread Denis Scherbakov
> Well at first glance it seemed to work, but in fact it is > not : A is still built before B, and fails to build missing > B.h. > > Please note that this only occurs on visual studio. Try to set B.h source file properties as GENERATED and include it into A_SRCS. Maybe this help. Could you pr

Re: [CMake] Generated source file dependencies

2009-05-13 Thread Denis Scherbakov
> >> The problem is that when using visual studio, A > might be > >> built before B, and fails to build because B.h has > not yet > >> be generated. > > > > Did you try > > > > ADD_DEPENDENCIES(A B) > > > > ? > > I have TARGET_LINK_LIBRARIES(A B), so I think the library > dependency is corr

Re: [CMake] Generated source file dependencies

2009-05-13 Thread Denis Scherbakov
> The problem is that when using visual studio, A might be > built before B, and fails to build because B.h has not yet > be generated. Did you try ADD_DEPENDENCIES(A B) ? Denis ___ Powered by www.kitware.com Visit other Kitware open-sour

[CMake] How to TRY_COMPILE a static executable?

2009-05-12 Thread Denis Scherbakov
I know that static is bad, but in order to be consistent with an upper-level project I must TRY_COMPILE a static executable. This means I must somehow pass CMAKE_EXE_LINKER_FLAGS to it which holds -static. Does anybody know a way? Denis ___ Po

Re: [CMake] howto not remove an output in make clean

2009-05-11 Thread Denis Scherbakov
> Is there a way to tell "make clean" to *not* > remove the output from > the custom command "foo.cpp" ? You could try INSTALL to place a copy of this file, where you want. Denis ___ Powered by www.kitware.com Visit other Kitware open-source

Re: [CMake] Implicity CMAKE_CURRENT_BINARY_DIR include_directories

2009-05-11 Thread Denis Scherbakov
> On Monday 11 May 2009, Denis Scherbakov wrote: > > CMAKE_LINK_DEPENDS_DEBUG_MODE is also not documented. > > Is this one an official public variable or may it go away > again ? If you ask me - I don't know, I am not a CMake developer. But there is a lot function

[CMake] Don't understand simple code

2009-05-11 Thread Denis Scherbakov
MACRO(MYTEST argTemp) LIST(LENGTH argTemp varLen) MESSAGE("Len: ${varLen}") SET (argTemp "${argTemp}") LIST(LENGTH argTemp varLen) MESSAGE("Len: ${varLen}") ENDMACRO () MYTEST("something;new") # prints: 0, 2 Am I referring variables in MACRO correctly? Why second version prints

Re: [CMake] Implicity CMAKE_CURRENT_BINARY_DIR include_directories

2009-05-11 Thread Denis Scherbakov
CMAKE_LINK_DEPENDS_DEBUG_MODE is also not documented. > > set(CMAKE_INCLUDE_CURRENT_DIR ON) > > > > Ooops, seems it's not documented. > > I'll fix that. > > Documentation committed to HEAD. ___ Powered by www.kitware.com Visit other Kitware

Re: [CMake] Static linking and find_library

2009-05-11 Thread Denis Scherbakov
Currently there is no way to do something like -Wl,-Bstatic -lname -Wl,-Bdynamic I can assume that some people in some situations may want to do that. > > Marcel Loose wrote: > ... > > > 2) How can I persuade find_library() to only > search for static > > > libraries? > > > > You can't. > > Peo

Re: [CMake] Static linking and find_library

2009-05-08 Thread Denis Scherbakov
> 1) Is there a generic platform- and compiler-independent > way to specify > that you want to create a statically linked executable? find /usr/share/cmake -type f | grep -E '\.cmake$' | xargs grep -i -n -H '\-static' No matches == there is no cross-platform way to specify that you want static

Re: [CMake] Automatic libraries stripping

2009-05-07 Thread Denis Scherbakov
> I would like to ask you, if (and how, if so) it is possible > to set CMake > to strip (/usr/bin/strip) the generated libraries. Use -s option for gcc. You don't need to use strip directly. Denis ___ Powered by www.kitware.com Visit other Ki

Re: [CMake] Create executable with no dynamic dependency at all

2009-05-07 Thread Denis Scherbakov
James, I took a look again at our source and notices, that we set CMAKE_BUILD_TYPE to Custom, so no default options migrate into our environment. I think you receive -Wl,-Bdynamic from cmake/Modules/Platform/Linux.cmake:25: SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") My system is

Re: [CMake] Create executable with no dynamic dependency at all

2009-05-07 Thread Denis Scherbakov
Jean-Pierre, I set -static flag in the top level CMakeLists.txt: SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") before ADD_SUBDIRECTORY. I didn't find any error in your files, I would do the same with exception to -static flag. Denis > May I ask what platform you are using?

Re: [CMake] Create executable with no dynamic dependency at all

2009-05-07 Thread Denis Scherbakov
Jean-Pierre, I am not sure, how you get -Wl,-Bstatic and so on. Here is how I get static executable: $ /usr/bin/c++ -O2 -fomit-frame-pointer -fPIC -s -static \ CMakeFiles/DispatcherExe.dir/DispatcherMain.cc.o \ -o DispatcherExe \ -rdynamic ../../Generic/libGeneric.a \ ../../CorbaUtil/libCorbaU

Re: [CMake] foreach() bug?

2009-05-05 Thread Denis Scherbakov
The only solution I see is to use LIST(GET... But you'll need to get LIST length somehow... Denis --- On Tue, 5/5/09, alexandre.feb...@thomsonreuters.com wrote: > From: alexandre.feb...@thomsonreuters.com > > Subject: Re: [CMake] foreach() bug? > To: cmake@cmake.org > Date: Tuesday, May 5,

Re: [CMake] Tricky question once more

2009-05-05 Thread Denis Scherbakov
I have checked cmGlobalGenerator.cxx and its CheckLocalGenerators function. This seems to the right place to perform all checks. I think I could make a global variable CMAKE_ALLOW_PARTIAL_PROJECT_TREE, which I could check in this function. If a target has a failed dependency, then I should rewri

[CMake] Tricky question once more

2009-05-05 Thread Denis Scherbakov
Once more: I have 3 projects. projectA depends on projectB projectB depends on SOMEAPP_INCLUDES and SOMEAPP_LIBRARIES projectC does not depend on anything I have FindSomeApp script that sets SOMEAPP_FOUND 1. I want to be able to complete cmake configuration, and build projectC, even if project

Re: [CMake] About link external object files

2009-04-30 Thread Denis Scherbakov
PROJECT(MYFORTRANCODE Fortran) SET (MYFORTRANCODE_SRCS source.f ) ADD_LIBRARY(mylib ${MYFORTRANCODE_SRCS}) > Hello! I am newcomer for cmake! I want to compile an dll > files with an > object file which generated by gfortran. How to do that ?

Re: [CMake] cmake hp-ux binary creates .sl libraries rather than .so libraries.

2009-04-28 Thread Denis Scherbakov
> Usually uname can report this, uname -m here on Linux. The machine I am working on gives ia64. PA-RISC machines give something strange: http://curl.haxx.se/mail/curlpp-2008-11/att-0051/config.log > You are building HP-UX binaries on a Linux machine ? > This would be really cross compiling.

Re: [CMake] cmake hp-ux binary creates .sl libraries rather than .so libraries.

2009-04-28 Thread Denis Scherbakov
> The change will have to go in Modules/Platform/HP-UX.cmake. > I think we should be able to check the > CMAKE_HOST_SYSTEM_PROCESSOR variable. Is there a tool I can run to tell you exactly, how processor names shuld look like? Is it "file" or something else? > If someone has > access to one

Re: [CMake] Question on variable check in Cmake macro files

2009-04-28 Thread Denis Scherbakov
UNSET (HAVE_SOMETHING CACHE) > Is there any way to force the check to run without deleting > the cache > file? ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Plea

Re: [CMake] cmake hp-ux binary creates .sl libraries rather than .so libraries.

2009-04-28 Thread Denis Scherbakov
HP-UX on PA-RISC uses *.sl or no extension (like libC.2 for PA-RISC 2.0) HP-UX on IA64 uses *.so naming like in Linux. > I believe .sl is the correct extension for shared libraries > on HPUX: ___ Powered by www.kitware.com Visit other Kitware

Re: [CMake] how to build two libraries from same sources but with different defines?

2009-04-24 Thread Denis Scherbakov
COMPILE_FLAGS in SET_TARGET_PROPERTIES will allow you to set per-target compile flags and definitions. Denis > I am building my library for two different processors arm7 > and arm9. > devkitArm requeres ARM7 or ARM9 macroses should be defined > when > building for any processor. I tried to wr

[CMake] Location of ar and ld during cross-compilation

2009-04-20 Thread Denis Scherbakov
I have a set of cross-compilers and toolchain files for them. Our binutils are separated from gcc. Say: /cross/path/binutils/bin /cross/path/gcc/bin As I understood from CMakeFindBinUtils.cmake script, it looks for binutils only in /cross/path/gcc/bin, and ignores CMAKE_FIND_ROOT_PATH complete

Re: [CMake] Mfc flag

2009-04-20 Thread Denis Scherbakov
Elizabeta, In your code snippet everything is ok. CMAKE_MFC_FLAG is 2 after it is set. No sooner no later. If you give complete example, which does not work, then you'll get an answer. Did you mean the following? ADD_SUBDIRECTORY(ProjectA) # MFC_VAR not defined SET (MFC_VAR 2) ADD_SUBDIRECTOR

Re: [CMake] fortran flags in a c++ linked executable

2009-04-01 Thread Denis Scherbakov
Elena, Try to compile and link by hand. For example - write one CPP, one F90, then compile them with flags you want and link them with flags you want. After you find out, what you need, you may start experimenting with CMake flags. gmake VERBOSE=1 can help you alot to see what is happening du

Re: [CMake] fortran flags in a c++ linked executable

2009-03-31 Thread Denis Scherbakov
If you want to pass something to g++ linker, you should do this with -Wl,--my-special-flag Denis > > Should not the flag be passed to the linker? So in > this case the linker flags are read from the c++ compiler > flags? > > > > I tried adding > add_definitions( ${CMAKE_Fortran_FLAGS}

[CMake] Bug in library link order?

2009-03-31 Thread Denis Scherbakov
Dear CMake Community, I have a project where there are: LibraryA LibraryB (depends on LibraryA) Executable (depends on LibraryB and xml2) during linking the order for link libraries is "LibraryB -lxml2 LibraryA". Should LibraryA (which is internal to the project) be specified before external

Re: [CMake] setting different include_directories, link_directories, etc for different targets

2009-03-26 Thread Denis Scherbakov
Jakub, I don't really understand, how it is possible, to share the same build directory with WIN32 object files and say Sparc-Solaris? Even, if you only talk about windows variations, how will you distinguish, file WindowUtilApp.obj was compiled for WinXP or WinCE? At build time - it is NOT p

Re: [CMake] setting different include_directories, link_directories, etc for different targets

2009-03-26 Thread Denis Scherbakov
You should setup a separate build directory for each platform and run CMake there with configuration options you want. Denis > I would like to build the same source tree for different > platforms. A > platform means various embedded OSes, WIN32, etc. > Compilation for each > platform may diffe

Re: [CMake] Argument passing to shell script through cmake

2009-03-26 Thread Denis Scherbakov
You could add your custom target and specify that some target depends on it. ADD_CUSTOM_TRAGET(TargetScript COMMAND shell-script.sh) ADD_EXECUTABLE(TargetExe ${TARGET_SRCS}) ADD_DEPENDENCIES(TargetExe TargetScript) You could also use ADD_CUSTOM_COMMAND and it's PRE_BUILD/PRE_LINK feature. ADD_

Re: [CMake] How to adjust LD_LIBRARY_PATH for an exectubale?

2009-03-25 Thread Denis Scherbakov
Alex, In CMake I can check for WIN32 MINGW CYGWIN MSVC UNIX APPLE I don't know, how to distinguish different unix variations. Denis > Well, if you care for LD_LIBRARY_PATH, DYLD_LIBRARY_PATH > and PATH you have > taken care of most platforms. > Which other platforms do you need ?

Re: [CMake] Argument passing to shell script through cmake

2009-03-25 Thread Denis Scherbakov
Did you try EXECUTE_PROCESS and ADD_CUSTOM_COMMAND? Denis --- On Wed, 3/25/09, ankit jain wrote: > From: ankit jain > Subject: [CMake] Argument passing to shell script through cmake > To: cmake@cmake.org > Date: Wednesday, March 25, 2009, 5:54 AM > Hi all, > > I want to run one shell script

Re: [CMake] How to adjust LD_LIBRARY_PATH for an exectubale?

2009-03-25 Thread Denis Scherbakov
Unfortunatelly, the idea with a shell script is not portable. Here you can see all possible LD_LIBRARY_PATH combinations: http://www.vtk.org/Wiki/CMake_Platform_Dependent_Issues Denis > >> I have an external executable which requires a > library, which is not in > >> LD_LIBRARY_PATH. If I manu

Re: [CMake] Feature request: generic (config-like) selector on target_link_libraries

2009-03-24 Thread Denis Scherbakov
I am not sure, but I think you could also look into ADD_CUSTOM_COMMAND and it's PRE_LINK feature. You could run your own script before linking is done and replace lib4 target with what you want - lib4a version or lib4b. Denis ___ Powered by www

Re: [CMake] Feature request: generic (config-like) selector on target_link_libraries

2009-03-24 Thread Denis Scherbakov
> Specifying the lib4 dependency in the exe? But what about > dependencies > order in the link line? In my example, lib4-A or lib4-B > must appear > after lib3, if I want lib4 symbols required by lib3 to be > added. In your > solution, lib4 might as well be added by cmake just after > lib1 and > b

Re: [CMake] Feature request: generic (config-like) selector on target_link_libraries

2009-03-24 Thread Denis Scherbakov
I think you don't need a new feature, you just have to use IF-ELSE mechanism and then TARGET_LINK_LIBRARIES(target ${RESULT_OF_IF_ELSE}) Denis > * lib3 CMakeLists.txt: > > add_library(lib3 some source) > target_link_libraries(lib3, > SELECTOR A_OR_B A lib4-A > SELECTOR A_OR_B B lib4-B

[CMake] How to adjust LD_LIBRARY_PATH for an exectubale?

2009-03-24 Thread Denis Scherbakov
Dear CMake Community, I have an external executable which requires a library, which is not in LD_LIBRARY_PATH. If I manually set ENV{LD_LIBRARY_PATH} and then execute a command, it works. But the problem is that the executable is inside ADD_CUSTOM_COMMAND and even if I set environment variabl

Re: [CMake] Link error when building static exe against static Qt 4.5 plugin

2009-03-23 Thread Denis Scherbakov
Steve, To be platform independent use FIND_LIBRARY and its HINTS option. You may want to check CMake/Modules/Find*.cmake files. There are great examples how to be fully platform independent. If BUILD_SHARED_LIBS, then ALL libraries in your project will be built shared. I use for this one separat

Re: [CMake] Link error when building static exe against static Qt 4.5 plugin

2009-03-23 Thread Denis Scherbakov
Steve, Linking statically is always more work. Shared object dependencies are resolved automatically. Static dependencies - not. To link against shared OpenSSL I need only to specify -lopenssl. To link statically I need -lopenssl and -lcrypto, because libopenssl.a depends on libcrypto.a and t

Re: [CMake] How to generate preprocessed file?

2009-03-23 Thread Denis Scherbakov
Marcel, I am not sure what you need. If you want to convert config.h.in into config.h, then see CONFIGURE_FILE and #cmakedefine. For other files you may want to check ADD_CUSTOM_COMMAND and SET_SOURCE_FILES_PROPERTIES(${FILE} PROPERTIES GENERATED TRUE) Denis > I was trying to figure out how

Re: [CMake] Link error when building static exe against static Qt 4.5 plugin

2009-03-23 Thread Denis Scherbakov
Hi! You need to also link against libqsqlmysql.so library. It must appear after qt libraries (and any other libraries that use qsqlmysql interfaces). Denis > I'm trying to build a fully static exe on Opensuse 11.1 > against a static > build of Qt 4.5, and > I'm trying to link against a static

Re: [CMake] How to declare global variables

2009-03-23 Thread Denis Scherbakov
I also have a very big project with sub-projects lying in different tree leafs. And when I started to learn CMake I also had a question, how to define variables that can be seen on other project in other tree leaf. What I also learned from a newsgroup is that most of the time, when you need va

[CMake] CMake and HAVE_SIGFPE

2009-03-18 Thread Denis Scherbakov
Dear CMake Community, Could anyone give me a hint, how to check if a system can handle SIGFPE signal and set HAVE_SIGFPE variable. For example, linux on alpha machines produces a core dump instead of SIGFPE. Many thanks in advance. Denis ___

Re: [CMake] preventing redundant compilations

2009-03-18 Thread Denis Scherbakov
You could do the following: ADD_LIBRARY(intermediate STATIC a.cpp) ADD_LIBRARY(foo b.cpp) TARGET_LINK_LIBRARIES(foo intermediate) ADD_LIBRARY(bar c.cpp) TARGET_LINK_LIBRARIES(bar intermediate) Denis > One of the users I support complained about the following: > > add_library(foo a.c b.c) >

Re: [CMake] Progress reporting in CMake

2009-03-17 Thread Denis Scherbakov
I see progress jumping even on freshly CMake prepared, but never compiled tree. So is this a bug or a feature? Denis > Works pretty good for me (~120 .c's). I notice jumps > when building > semi-up-to-date trees (ie, only some of the source files > have changed) > which seems reasonable. > >

[CMake] Progress reporting in CMake

2009-03-17 Thread Denis Scherbakov
Dear CMake Gurus, Can you, please explain, how progress reporting in CMake is organised? I have a project with more than 100 files organised into subprojects. Still progress jumps from 0% to 4% ... from 14% to 19%. Why is that? Frankly speaking, I've never seen in any of my CMake projects (inc

Re: [CMake] Running a Python script at PRE_BUILD

2009-03-16 Thread Denis Scherbakov
Hi! You may want to look at http://www.cmake.org/pipermail/cmake/2009-March/027774.html I generate *.cpp files from CORBA *.idl files before the project is compiled. The same you can do for header files. Exactly at PRE_BUILD - it works only on Visual Studio. Why no everywhere? I also wonder.

Re: [CMake] Non existent / new file handling

2009-03-13 Thread Denis Scherbakov
John, You may want to look into ADD_CUSTOM_COMMAND. PROJECT(CORBASAMPLE) ADD_CUSTOM_COMMAND( OUTPUT "${PROJECT_BINARY_DIR}/MyMicoGeneratedSource.cpp" COMMAND "${MICO_IDL_EXECUTABLE}" --hh-suffix=hh --any --poa ${PROJECT_SOURCE_DIR}/IdlSource.idl) SET_SOURCE_FILES_PROP

Re: [CMake] 1 tricky question, 1 bug report

2009-03-13 Thread Denis Scherbakov
Eric, Your solution requires a developer to know too much about the project, which is not always true and basically to answer a full-scale questionnaire before compilation. What if it is a new developer? What if it is not a developer, but a user who expects everything to compile automatically?

Re: [CMake] 1 tricky question, 1 bug report

2009-03-13 Thread Denis Scherbakov
Dear Marcel Loose, I tried what you have suggested and it doesn't work also. Here is what I have: =CMakeLists.txt CMAKE_MINIMUM_REQUIRED(VERSION 2.6.1 FATAL_ERROR) ADD_SUBDIRECTORY("printf") ADD_SUBDIRECTORY("puts") ADD_SUBDIRECTORY("forbug") SET(MAIN_SRCS main.cpp) INCLUDE_DI

Re: [CMake] 1 tricky question, 1 bug report

2009-03-13 Thread Denis Scherbakov
> I don't understand the question here? At gmake time > why do they need to know anything about mico or libxml2? Ok, I will try harder now: Let's say I have a main CMakeLists.txt and 2 sub projects: =CMakeLists.txt CMAKE_MINIMUM_REQUIRED(VERSION 2.6.1 FATAL_ERROR) INCLUDE(FindLibX

[CMake] 1 tricky question, 1 bug report

2009-03-13 Thread Denis Scherbakov
Dear CMake list subscripers, I have a project with verious ADD_LIBRARY/ADD_EXECUTABLE targets in different subdirectories. Some of these targets depend on mico corba, some don't. As well as some depend on libxml2, some don't. We have developers working on sub-projects, which do not require mic