[CMake] getting undefined error to my own libs.

2009-12-29 Thread e...@cs.bgu.ac.il
hello.
I'm writing a c++ program that uses three shared libs that I wrote, for some 
reason, when it gets to the main cpp file, it fails with undefined error. here 
is the error report:

Linking CXX executable ../build/ossm
   
cd /home/dagg/workspace/OSSM/src && /usr/bin/cmake -E cmake_link_script 
CMakeFiles/ossm.dir/link.txt --verbose=1
  
/usr/bin/c++ -fPIC CMakeFiles/ossm.dir/COssm.cpp.o  -o ../build/ossm 
-rdynamic ../build/libs/libDataObjects.so ../build/libs/libUtilities.so 
../build/libs/libThreads.so ../build/libs/libUtilities.so -lboost_thread-mt 
-lboost_unit_test_framework-mt -Wl,-rpath,/home/dagg/workspace/OSSM/build/libs  

   
CMakeFiles/ossm.dir/COssm.cpp.o: In function `Ossm::cleanUp()': 
   
/home/dagg/workspace/OSSM/src/COssm.cpp:33: undefined reference to 
`Array::Array(int)'   
/home/dagg/workspace/OSSM/src/COssm.cpp:35: undefined reference to 
`Array::operator[](int)'  
/home/dagg/workspace/OSSM/src/COssm.cpp:39: undefined reference to 
`Array::operator[](int)'  
CMakeFiles/ossm.dir/COssm.cpp.o: In function `~World':  
   
/home/dagg/workspace/OSSM/src/DataObjects/CWorld.hpp:30: undefined reference to 
`Array::~Array()'  
  
/home/dagg/workspace/OSSM/src/DataObjects/CWorld.hpp:30: undefined reference to 
`Array::~Array()'
  
/home/dagg/workspace/OSSM/src/DataObjects/CWorld.hpp:30: undefined reference to 
`Array::~Array()'   
  
/home/dagg/workspace/OSSM/src/DataObjects/CWorld.hpp:30: undefined reference to 
`Array::~Array()' 
  
/home/dagg/workspace/OSSM/src/DataObjects/CWorld.hpp:30: undefined reference to 
`Array::~Array()'
  
CMakeFiles/ossm.dir/COssm.cpp.o: In function `Ossm::cleanUp()': 
   
/home/dagg/workspace/OSSM/src/COssm.cpp:44: undefined reference to 
`Array::~Array()' 
/home/dagg/workspace/OSSM/src/COssm.cpp:44: undefined reference to 
`Array::~Array()' 
CMakeFiles/ossm.dir/COssm.cpp.o: In function `~World':  
   
/home/dagg/workspace/OSSM/src/DataObjects/CWorld.hpp:30: undefined reference to 
`Array::~Array()'
  
/home/dagg/workspace/OSSM/src/DataObjects/CWorld.hpp:30: undefined reference to 
`Array::~Array()' 
  
/home/dagg/workspace/OSSM/src/DataObjects/CWorld.hpp:30: undefined reference to 
`Array::~Array()'   
  
/home/dagg/workspace/OSSM/src/DataObjects/CWorld.hpp:30: undefined reference to 
`Array::~Array()'
  
./build/libs/libThreads.so: undefined reference to 
`boost::iostreams::detail::bzip2_base::~bzip2_base()'   
  
./build/libs/libUtilities.so: undefined reference to 
`DataFactory::~DataFactory()'
./build/libs/libDataObjects.so: undefined reference to 
`Array::Array()' 
./build/libs/libUtilities.so: undefined reference to 
`Array, std::allocator > 
>::operator[](int)'   
./build/libs/libUtilities.so: undefined reference to `Array::size() 
const'
./build/libs/libDataObjects.so: undefined reference to 
`Array::Array()'  
./build/libs/libUtilities.so: undefined reference to `Array::Array(int)' 
  
./build/libs/libUtilities.so: undefined reference to `Array::~Array()'  
  
./build/libs/libUtilities.so: undefined reference to `Array::size() 
const'
./build/libs/libThreads.so: undefined reference to `vtable for 
StaffSaverThread'  
./build/libs/libUtilities.so: undefined reference to `vtable for Utils' 
  
./build/libs/libDataObjects.so: undefined reference to `Array::Array(int)' 
./build/libs/libUtilities.so: undefined reference to 
`Array, std::allocator > 
>::size() const'  
./build/libs/libDataObjects.so: undefined reference to 
`Array, std::allocator > 
>::

Re: [CMake] getting undefined error to my own libs.

2009-12-29 Thread Eric Noulard
2009/12/29 e...@cs.bgu.ac.il :
> hello.
> I'm writing a c++ program that uses three shared libs that I wrote, for some 
> reason, when it gets to the main cpp file, it fails with undefined error. 
> here is the error report:

Concerning the link error [apparently] related to boost usage I let
Boost+CMake user
help you.

Concerning the first errors related to your templated Array class
how did you split your
CArray.cpp
CArray.hpp
files?

Since CArray seems to be a templated class I bet the CArray.hpp contains
the code and/or includes CArray.cpp ?

If not you should ensure that the (template) instance of class you are
using in your
main program are instantiated in the DataObject library if not you may
get missing
symbols like the one you get here:

> Linking CXX executable ../build/ossm
> cd /home/dagg/workspace/OSSM/src && /usr/bin/cmake -E cmake_link_script 
> CMakeFiles/ossm.dir/link.txt --verbose=1
> /usr/bin/c++     -fPIC CMakeFiles/ossm.dir/COssm.cpp.o  -o ../build/ossm 
> -rdynamic ../build/libs/libDataObjects.so ../build/libs/libUtilities.so 
> ../build/libs/libThreads.so ../build/libs/libUtilities.so -lboost_thread-mt 
> -lboost_unit_test_framework-mt -Wl,-rpath,/home/dagg/workspace/OSSM/build/libs
> CMakeFiles/ossm.dir/COssm.cpp.o: In function `Ossm::cleanUp()':
> /home/dagg/workspace/OSSM/src/COssm.cpp:33: undefined reference to 
> `Array::Array(int)'
> /home/dagg/workspace/OSSM/src/COssm.cpp:35: undefined reference to 
> `Array::operator[](int)'
> /home/dagg/workspace/OSSM/src/COssm.cpp:39: undefined reference to 
> `Array::operator[](int)'
> CMakeFiles/ossm.dir/COssm.cpp.o: In function `~World':

[...]

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
Powered by www.kitware.com

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

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

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


Re: [CMake] getting undefined error to my own libs.

2009-12-29 Thread e...@cs.bgu.ac.il
hello Eric, thanks for the response.
I'd like to solve the Array issue first, then the boost because I have a 
feeling it is a different one because when I disable the relevant code it 
doesn't generates the error even when other parts of the program (such as the 
threadpool).
here are the array files content: http://codepad.org/klDWMowB
beside a strange typo that I've done, I don't thing I've miss configured it 
somehow.
On Tue 29 Dec 15:42 2009 Eric Noulard wrote:
> 2009/12/29 e...@cs.bgu.ac.il :
> > hello.
> > I'm writing a c++ program that uses three shared libs that I wrote, for 
> > some reason, when it gets to the main cpp file, it fails with undefined 
> > error. here is the error report:
> 
> Concerning the link error [apparently] related to boost usage I let
> Boost+CMake user
> help you.
> 
> Concerning the first errors related to your templated Array class
> how did you split your
> CArray.cpp
> CArray.hpp
> files?
> 
> Since CArray seems to be a templated class I bet the CArray.hpp contains
> the code and/or includes CArray.cpp ?
> 
> If not you should ensure that the (template) instance of class you are
> using in your
> main program are instantiated in the DataObject library if not you may
> get missing
> symbols like the one you get here:
> 
> > Linking CXX executable ../build/ossm
> > cd /home/dagg/workspace/OSSM/src && /usr/bin/cmake -E cmake_link_script 
> > CMakeFiles/ossm.dir/link.txt --verbose=1
> > /usr/bin/c++     -fPIC CMakeFiles/ossm.dir/COssm.cpp.o  -o ../build/ossm 
> > -rdynamic ../build/libs/libDataObjects.so ../build/libs/libUtilities.so 
> > ../build/libs/libThreads.so ../build/libs/libUtilities.so -lboost_thread-mt 
> > -lboost_unit_test_framework-mt 
> > -Wl,-rpath,/home/dagg/workspace/OSSM/build/libs
> > CMakeFiles/ossm.dir/COssm.cpp.o: In function `Ossm::cleanUp()':
> > /home/dagg/workspace/OSSM/src/COssm.cpp:33: undefined reference to 
> > `Array::Array(int)'
> > /home/dagg/workspace/OSSM/src/COssm.cpp:35: undefined reference to 
> > `Array::operator[](int)'
> > /home/dagg/workspace/OSSM/src/COssm.cpp:39: undefined reference to 
> > `Array::operator[](int)'
> > CMakeFiles/ossm.dir/COssm.cpp.o: In function `~World':
> 
> [...]
> 
> -- 
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
> 




___
Powered by www.kitware.com

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

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

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

Re: [CMake] getting undefined error to my own libs.

2009-12-29 Thread Eric Noulard
2009/12/29 e...@cs.bgu.ac.il :
> hello Eric, thanks for the response.
> I'd like to solve the Array issue first, then the boost because I have a 
> feeling it is a different one because when I disable the relevant code it 
> doesn't generates the error even when other parts of the program (such as the 
> threadpool).
> here are the array files content: http://codepad.org/klDWMowB

I assume the content of the .hpp is between #ifndef CARRAY_HPP
then the code is the .cpp file.

The trouble comes from the fact that your class is a template one,
so that the content of the .cpp file may not be compiled independently
"as-is" because it must be instantiated first.

I invite you to read this:
http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
and may be this one too:
http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp

Note that the "export keyword" solution may not be a good one
because many compilers do not implement it, beginning with gcc:
http://gcc.gnu.org/bugs/#nonbugs_cxx

> beside a strange typo that I've done, I don't thing I've miss configured it 
> somehow.

I think may be you did not played a lot with templated classes.
(just a guess I may be wrong).

Concerning this issue, I'm pretty sure this is not a CMake one.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
Powered by www.kitware.com

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

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

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


Re: [CMake] getting undefined error to my own libs.

2009-12-29 Thread e...@cs.bgu.ac.il

On Tue 29 Dec 17:16 2009 Eric Noulard wrote:
> 2009/12/29 e...@cs.bgu.ac.il :
> > hello Eric, thanks for the response.
> > I'd like to solve the Array issue first, then the boost because I have a 
> > feeling it is a different one because when I disable the relevant code it 
> > doesn't generates the error even when other parts of the program (such as 
> > the threadpool).
> > here are the array files content: http://codepad.org/klDWMowB
> 
> I assume the content of the .hpp is between #ifndef CARRAY_HPP
> then the code is the .cpp file.
> 
yes, your right.
> The trouble comes from the fact that your class is a template one,
> so that the content of the .cpp file may not be compiled independently
> "as-is" because it must be instantiated first.
> 
> I invite you to read this:
> http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
> and may be this one too:
> http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp
> 
> Note that the "export keyword" solution may not be a good one
> because many compilers do not implement it, beginning with gcc:
> http://gcc.gnu.org/bugs/#nonbugs_cxx
> 
> > beside a strange typo that I've done, I don't thing I've miss configured it 
> > somehow.
> 
> I think may be you did not played a lot with templated classes.
> (just a guess I may be wrong).
> 
I have some but if you say that I'm doing it wrong, then there is a good chance 
I am.
> Concerning this issue, I'm pretty sure this is not a CMake one.
I've posted it here because what I had before have compiled well without any 
problems and uncommenting that part generated the error.
will take
> 
> -- 
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
> 




___
Powered by www.kitware.com

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

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

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

Re: [CMake] [vtkusers] Coexistence of different Win32 libraries

2009-12-29 Thread John Drescher
On Tue, Dec 29, 2009 at 10:39 AM, Kenneth Porter  wrote:
> --On Monday, December 28, 2009 10:45 AM -0500 John Drescher
>  wrote:
>
>> Here is what I do.
>
>> [script]
>
> Thanks. Must I put that in the project's CMakeLists.txt or can I capture
> that to a file I can inject each time I run cmake? I'm relatively new to
> cmake so I don't yet see how build-host-wide defaults are set. I thought I
> could inject it with -C but that doesn't seem to be affecting the generated
> cache or project files.
>
>

I put that in my CMakeLists.txt of the project.

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] Overriding read-only project's CMakeLists.txt

2009-12-29 Thread Kenneth Porter
Where can I put build instructions that are build-host-wide, not 
project-wide?


I'm relatively new to cmake. I want to "inject" some code before the 
project's own script, and I'd prefer not to modify the project (since then 
I'd have to maintain the patch).


I want to set the CMAKE__PREFIX variables based on the version of 
Visual Studio used and whether it's a debug or release build. (I've been 
given code to do this on the VTK list, but I don't see how to use it apart 
from editing VTK's file.)

___
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] Overriding read-only project's CMakeLists.txt

2009-12-29 Thread John Drescher
> Where can I put build instructions that are build-host-wide, not
> project-wide?
>
> I'm relatively new to cmake. I want to "inject" some code before the
> project's own script, and I'd prefer not to modify the project (since then
> I'd have to maintain the patch).
>
> I want to set the CMAKE__PREFIX variables based on the version of
> Visual Studio used and whether it's a debug or release build. (I've been
> given code to do this on the VTK list, but I don't see how to use it apart
> from editing VTK's file.)
>

You can create your own CMakeLists.txt file that drives the build
process for the dependencies. This way I believe you can inject these
variables. This was discussed recently (in the last 2 to 3 weeks) on
the list.

Also I think you can pass these on the command line via a batch file
that calls cmake or cmake-gui for the user.

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


Re: [CMake] getting undefined error to my own libs.

2009-12-29 Thread e...@cs.bgu.ac.il
ok, I've read the links, let say I'm not use the export option, when I look at 
the how to avoid link errors here: 
http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13 I see that what 
I've did is the same, isn't it? 
I'm not sure where to follow from here... if I've did what they say and I still 
get a undefined error, then I must have miss configured cmake.
when I add extern to the deceleration in the header, I get this error: storage 
class specified for `Array`

On Tue 29 Dec 17:16 2009 Eric Noulard wrote:
> 2009/12/29 e...@cs.bgu.ac.il :
> > hello Eric, thanks for the response.
> > I'd like to solve the Array issue first, then the boost because I have a 
> > feeling it is a different one because when I disable the relevant code it 
> > doesn't generates the error even when other parts of the program (such as 
> > the threadpool).
> > here are the array files content: http://codepad.org/klDWMowB
> 
> I assume the content of the .hpp is between #ifndef CARRAY_HPP
> then the code is the .cpp file.
> 
> The trouble comes from the fact that your class is a template one,
> so that the content of the .cpp file may not be compiled independently
> "as-is" because it must be instantiated first.
> 
> I invite you to read this:
> http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
> and may be this one too:
> http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp
> 
> Note that the "export keyword" solution may not be a good one
> because many compilers do not implement it, beginning with gcc:
> http://gcc.gnu.org/bugs/#nonbugs_cxx
> 
> > beside a strange typo that I've done, I don't thing I've miss configured it 
> > somehow.
> 
> I think may be you did not played a lot with templated classes.
> (just a guess I may be wrong).
> 
> Concerning this issue, I'm pretty sure this is not a CMake one.
> 
> -- 
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
> 




___
Powered by www.kitware.com

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

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

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

Re: [CMake] Overriding read-only project's CMakeLists.txt

2009-12-29 Thread Michael Wild

On 29. Dec, 2009, at 17:26 , Kenneth Porter wrote:

> Where can I put build instructions that are build-host-wide, not project-wide?
> 
> I'm relatively new to cmake. I want to "inject" some code before the 
> project's own script, and I'd prefer not to modify the project (since then 
> I'd have to maintain the patch).
> 
> I want to set the CMAKE__PREFIX variables based on the version of 
> Visual Studio used and whether it's a debug or release build. (I've been 
> given code to do this on the VTK list, but I don't see how to use it apart 
> from editing VTK's file.)
> 

Have a look at the -C option which allows you to set cache variables before 
anything else runs. You can use that in a batch script to set up things 
automatically.

And it's not CMAKE__PREFIX you want (no such variable, except 
CMAKE_INSTALL_PREFIX, which is probably not what you meant), but 
CMAKE__POSTFIX, where  is Debug, Release, RelWithDebInfo, 
MinSizeRel and any other configuration the project lists in 
CMAKE_CONFIGURATION_TYPES.


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] Overriding read-only project's CMakeLists.txt

2009-12-29 Thread Kenneth Porter
--On Tuesday, December 29, 2009 5:55 PM +0100 Michael Wild 
 wrote:



Have a look at the -C option which allows you to set cache variables
before anything else runs. You can use that in a batch script to set up
things automatically.


My initial attempt at that used John's example of if(MSVC) but I'm guessing 
that file can't use anything but simple variable assignments.



And it's not CMAKE__PREFIX you want (no such variable, except
CMAKE_INSTALL_PREFIX, which is probably not what you meant), but
CMAKE__POSTFIX, where  is Debug, Release, RelWithDebInfo,
MinSizeRel and any other configuration the project lists in
CMAKE_CONFIGURATION_TYPES.


Doh, you're right. Typo while transcribing.
___
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] getting undefined error to my own libs.

2009-12-29 Thread e...@cs.bgu.ac.il
I'm trying to refrain from using that because it can bloat up the executable 
size... unless you can tell me otherwise. in general the program will be 
compiled using g++ for now, maybe I'll add support for windows compiler later.
also, I'm trying to keep the definitions to the header files and the code to 
the src files.
On Tue 29 Dec 18:59 2009 aaron_wri...@selinc.com wrote:
> Just put the implementation of the template
> class in the declaration. Get that to work, then try to get fancy if you
> want to.
> 
-
> Aaron Wright
> 
> 
> 
> 
> 
> 
> 
> 
> "e...@cs.bgu.ac.il"
>  
> 
Sent by: cmake-boun...@cmake.org
> 
> 12/29/2009 08:54 AM
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> To
> 
> Eric Noulard 
> 
> 
> 
> 
> cc
> 
> cmake@cmake.org
> 
> 
> 
> 
> Subject
> 
> Re: [CMake] getting undefined error
> to my own libs.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
ok, I've read the links, let say I'm not use the export
> option, when I look at the how to avoid link errors here: 
> http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13[1]
> I see that what I've did is the same, isn't it? 
> I'm not sure where to follow from here... if I've did what they say and
> I still get a undefined error, then I must have miss configured cmake.
> when I add extern to the deceleration in the header, I get this error:
> storage class specified for `Array`
> 
> On Tue 29 Dec 17:16 2009 Eric Noulard wrote:
> > 2009/12/29 e...@cs.bgu.ac.il :
> > > hello Eric, thanks for the response.
> > > I'd like to solve the Array issue first, then the boost because
> I have a feeling it is a different one because when I disable the relevant
> code it doesn't generates the error even when other parts of the program
> (such as the threadpool).
> > > here are the array files content: http://codepad.org/klDWMowB[2]
> > 
> > I assume the content of the .hpp is between #ifndef CARRAY_HPP
> > then the code is the .cpp file.
> > 
> > The trouble comes from the fact that your class is a template one,
> > so that the content of the .cpp file may not be compiled independently
> > "as-is" because it must be instantiated first.
> > 
> > I invite you to read this:
> > http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12[3]
> > and may be this one too:
> > http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp[4]
> > 
> > Note that the "export keyword" solution may not be a good
> one
> > because many compilers do not implement it, beginning with gcc:
> > http://gcc.gnu.org/bugs/#nonbugs_cxx[5]
> > 
> > > beside a strange typo that I've done, I don't thing I've miss
> configured it somehow.
> > 
> > I think may be you did not played a lot with templated classes.
> > (just a guess I may be wrong).
> > 
> > Concerning this issue, I'm pretty sure this is not a CMake one.
> > 
> > -- 
> > Erk
> > Membre de l'April - « promouvoir et défendre le logiciel libre » -
> > http://www.april.org[6]
> > 
> 
> 
> 
> 
> ___
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html[7]
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ[8]
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake[9]
> 
>
References:
  1 : http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13
  2 : http://codepad.org/klDWMowB
  3 : http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
  4 : http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp
  5 : http://gcc.gnu.org/bugs/#nonbugs_cxx
  6 : http://www.april.org/
  7 : http://www.kitware.com/opensource/opensource.html
  8 : http://www.cmake.org/Wiki/CMake_FAQ
  9 : 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] getting undefined error to my own libs.

2009-12-29 Thread Aaron_Wright
With templates it's easiest to declare and implement in one file. The 
compiler likes this. Anything else you try requires extra work. Unless 
you're working in an embedded environment I don't see how executable size 
should even be a concern.
-
Aaron Wright



"e...@cs.bgu.ac.il"  
12/29/2009 09:11 AM

To
aaron_wri...@selinc.com
cc
cmake@cmake.org
Subject
Re: [CMake] getting undefined error to my own libs.






I'm trying to refrain from using that because it can bloat up the 
executable size... unless you can tell me otherwise. in general the 
program will be compiled using g++ for now, maybe I'll add support for 
windows compiler later.
also, I'm trying to keep the definitions to the header files and the code 
to the src files.
On Tue 29 Dec 18:59 2009 aaron_wri...@selinc.com wrote:
Just put the implementation of the template class in the declaration. Get 
that to work, then try to get fancy if you want to. 
-
Aaron Wright 


"e...@cs.bgu.ac.il"  
Sent by: cmake-boun...@cmake.org 
12/29/2009 08:54 AM 


To
Eric Noulard  
cc
cmake@cmake.org 
Subject
Re: [CMake] getting undefined error to my own libs.







ok, I've read the links, let say I'm not use the export option, when I 
look at the how to avoid link errors here: 
http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13 I see that 
what I've did is the same, isn't it? 
I'm not sure where to follow from here... if I've did what they say and I 
still get a undefined error, then I must have miss configured cmake.
when I add extern to the deceleration in the header, I get this error: 
storage class specified for `Array`

On Tue 29 Dec 17:16 2009 Eric Noulard wrote:
> 2009/12/29 e...@cs.bgu.ac.il :
> > hello Eric, thanks for the response.
> > I'd like to solve the Array issue first, then the boost because I have 
a feeling it is a different one because when I disable the relevant code 
it doesn't generates the error even when other parts of the program (such 
as the threadpool).
> > here are the array files content: http://codepad.org/klDWMowB
> 
> I assume the content of the .hpp is between #ifndef CARRAY_HPP
> then the code is the .cpp file.
> 
> The trouble comes from the fact that your class is a template one,
> so that the content of the .cpp file may not be compiled independently
> "as-is" because it must be instantiated first.
> 
> I invite you to read this:
> http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
> and may be this one too:
> http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp
> 
> Note that the "export keyword" solution may not be a good one
> because many compilers do not implement it, beginning with gcc:
> http://gcc.gnu.org/bugs/#nonbugs_cxx
> 
> > beside a strange typo that I've done, I don't thing I've miss 
configured it somehow.
> 
> I think may be you did not played a lot with templated classes.
> (just a guess I may be wrong).
> 
> Concerning this issue, I'm pretty sure this is not a CMake one.
> 
> -- 
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
> 




___
Powered by www.kitware.com

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

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

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



___
Powered by www.kitware.com

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

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

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

Re: [CMake] getting undefined error to my own libs.

2009-12-29 Thread e...@cs.bgu.ac.il
how much can this bloat my executable?
On Tue 29 Dec 19:16 2009 aaron_wri...@selinc.com wrote:
> With templates it's easiest to declare
> and implement in one file. The compiler likes this. Anything else you try
> requires extra work. Unless you're working in an embedded environment I
> don't see how executable size should even be a concern.
> 
-
> Aaron Wright
> 
> 
> 
> 
> 
> 
> 
> 
> "e...@cs.bgu.ac.il"
>  
> 
> 12/29/2009 09:11 AM
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> To
> 
> aaron_wri...@selinc.com
> 
> 
> 
> 
> cc
> 
> cmake@cmake.org
> 
> 
> 
> 
> Subject
> 
> Re: [CMake] getting undefined error
> to my own libs.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
I'm trying to refrain from using that because it can bloat
> up the executable size... unless you can tell me otherwise. in general
> the program will be compiled using g++ for now, maybe I'll add support
> for windows compiler later.
> also, I'm trying to keep the definitions to the header files and the code
> to the src files.
> 
On Tue 29 Dec 18:59 2009 aaron_wri...@selinc.com
> wrote:
> 
Just put the implementation of the template
> class in the declaration. Get that to work, then try to get fancy if you
> want to. 
> -
> Aaron Wright 
> 
> 
> 
> 
> 
> 
> 
> "e...@cs.bgu.ac.il"
>  
> Sent by: cmake-boun...@cmake.org 
> 
> 12/29/2009 08:54 AM
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> To
> 
> Eric Noulard 
> 
> 
> 
> 
> 
> cc
> 
> cmake@cmake.org
> 
> 
> 
> 
> 
> Subject
> 
> Re: [CMake] getting undefined error
> to my own libs.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ok, I've read the links, let say I'm not use the export option, when I
> look at the how to avoid link errors here: 
> http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13[1]
> I see that what I've did is the same, isn't it? 
> I'm not sure where to follow from here... if I've did what they say and
> I still get a undefined error, then I must have miss configured cmake.
> when I add extern to the deceleration in the header, I get this error:
> storage class specified for `Array`
> 
> On Tue 29 Dec 17:16 2009 Eric Noulard wrote:
> > 2009/12/29 e...@cs.bgu.ac.il :
> > > hello Eric, thanks for the response.
> > > I'd like to solve the Array issue first, then the boost because
> I have a feeling it is a different one because when I disable the relevant
> code it doesn't generates the error even when other parts of the program
> (such as the threadpool).
> > > here are the array files content: http://codepad.org/klDWMowB[2]
> > 
> > I assume the content of the .hpp is between #ifndef CARRAY_HPP
> > then the code is the .cpp file.
> > 
> > The trouble comes from the fact that your class is a template one,
> > so that the content of the .cpp file may not be compiled independently
> > "as-is" because it must be instantiated first.
> > 
> > I invite you to read this:
> > http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12[3]
> > and may be this one too:
> > http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp[4]
> > 
> > Note that the "export keyword" solution may not be a good
> one
> > because many compilers do not implement it, beginning with gcc:
> > http://gcc.gnu.org/bugs/#nonbugs_cxx[5]
> > 
> > > beside a strange typo that I've done, I don't thing I've miss
> configured it somehow.
> > 
> > I think may be you did not played a lot with templated classes.
> > (just a guess I may be wrong).
> > 
> > Concerning this issue, I'm pretty sure this is not a CMake one.
> > 
> > -- 
> > Erk
> > Membre de l'April - « promouvoir et défendre le logiciel libre » -
> > http://www.april.org[6]
> > 
> 
> 
> 
> 
> ___
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html[7]
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ[8]
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake[9]
> 
> 
> 
> 
> 
>
References:
  1 : http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13
  2 : http://codepad.org/klDWMowB
  3 : http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
  4 : http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp
  5 : http://gcc.gnu.org/bugs/#nonbugs_cxx
  6 : http://www.april.org/
  7 : http://www.kitware.com/opensource/opensource.html
  8 : http://www.cmake.org/Wiki/CMake_FAQ
  9 : 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] getting undefined error to my own libs.

2009-12-29 Thread Aaron_Wright
Just put the implementation of the template class in the declaration. Get 
that to work, then try to get fancy if you want to.
-
Aaron Wright



"e...@cs.bgu.ac.il"  
Sent by: cmake-boun...@cmake.org
12/29/2009 08:54 AM

To
Eric Noulard 
cc
cmake@cmake.org
Subject
Re: [CMake] getting undefined error to my own libs.






ok, I've read the links, let say I'm not use the export option, when I 
look at the how to avoid link errors here: 
http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13 I see that 
what I've did is the same, isn't it? 
I'm not sure where to follow from here... if I've did what they say and I 
still get a undefined error, then I must have miss configured cmake.
when I add extern to the deceleration in the header, I get this error: 
storage class specified for `Array`

On Tue 29 Dec 17:16 2009 Eric Noulard wrote:
> 2009/12/29 e...@cs.bgu.ac.il :
> > hello Eric, thanks for the response.
> > I'd like to solve the Array issue first, then the boost because I have 
a feeling it is a different one because when I disable the relevant code 
it doesn't generates the error even when other parts of the program (such 
as the threadpool).
> > here are the array files content: http://codepad.org/klDWMowB
> 
> I assume the content of the .hpp is between #ifndef CARRAY_HPP
> then the code is the .cpp file.
> 
> The trouble comes from the fact that your class is a template one,
> so that the content of the .cpp file may not be compiled independently
> "as-is" because it must be instantiated first.
> 
> I invite you to read this:
> http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
> and may be this one too:
> http://corfield.org/index.cfm/event/cplusplus.section/section/ptexp
> 
> Note that the "export keyword" solution may not be a good one
> because many compilers do not implement it, beginning with gcc:
> http://gcc.gnu.org/bugs/#nonbugs_cxx
> 
> > beside a strange typo that I've done, I don't thing I've miss 
configured it somehow.
> 
> I think may be you did not played a lot with templated classes.
> (just a guess I may be wrong).
> 
> Concerning this issue, I'm pretty sure this is not a CMake one.
> 
> -- 
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
> 




___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
___
Powered by www.kitware.com

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

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

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

[CMake] compiling single source with different flags

2009-12-29 Thread Bart
Hi,

I'm trying to find a way to build a library with two different instances of the 
same source file.
for example I would like to compile foo.c with -DDINT into foo_int.o and with 
-DDLONG into foo_long.o
and have both objects added to the same library libfoo.a

I have experimented with custom command to generate the source files (which did 
not work), and would have still
left me with how to compile them with different -D flags.

So I would be interested to hear how I would be able to do this.

Thanks,

Bart
___
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] compiling single source with different flags

2009-12-29 Thread Richard Wackerbarth
Not as a "real" solution, but more as a "workaround", you could create a 
"derived source file" which is just a copy of the source file and then you 
would have two separate files to be compiled with the appropriate flags.



On Dec 29, 2009, at 2:22 PM, Bart wrote:

> Hi,
> 
> I'm trying to find a way to build a library with two different instances of 
> the same source file.
> for example I would like to compile foo.c with -DDINT into foo_int.o and with 
> -DDLONG into foo_long.o
> and have both objects added to the same library libfoo.a
> 
> I have experimented with custom command to generate the source files (which 
> did not work), and would have still
> left me with how to compile them with different -D flags.
> 
> So I would be interested to hear how I would be able to do this.
> 
> Thanks,
> 
> Bart

___
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] compiling single source with different flags

2009-12-29 Thread Eric Noulard
2009/12/29 Richard Wackerbarth :
> Not as a "real" solution, but more as a "workaround", you could create a 
> "derived source file" which is just a copy of the source file and then you 
> would have two separate files to be compiled with the appropriate flags.

That's one solution, see below for more information.

> On Dec 29, 2009, at 2:22 PM, Bart wrote:
>
>> Hi,
>>
>> I'm trying to find a way to build a library with two different instances of 
>> the same source file.
>> for example I would like to compile foo.c with -DDINT into foo_int.o and 
>> with -DDLONG into foo_long.o
>> and have both objects added to the same library libfoo.a
>>
>> I have experimented with custom command to generate the source files (which 
>> did not work), and would have still
>> left me with how to compile them with different -D flags.

Same kind of question has been asked on the ML recently,
may be you can re-read the thread
http://www.cmake.org/pipermail/cmake/2009-December/033813.html


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
Powered by www.kitware.com

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

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

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


Re: [CMake] compiling single source with different flags

2009-12-29 Thread Michael Wild

On 29. Dec, 2009, at 21:44 , Eric Noulard wrote:

> 2009/12/29 Richard Wackerbarth :
>> Not as a "real" solution, but more as a "workaround", you could create a 
>> "derived source file" which is just a copy of the source file and then you 
>> would have two separate files to be compiled with the appropriate flags.
> 
> That's one solution, see below for more information.
> 
>> On Dec 29, 2009, at 2:22 PM, Bart wrote:
>> 
>>> Hi,
>>> 
>>> I'm trying to find a way to build a library with two different instances of 
>>> the same source file.
>>> for example I would like to compile foo.c with -DDINT into foo_int.o and 
>>> with -DDLONG into foo_long.o
>>> and have both objects added to the same library libfoo.a
>>> 
>>> I have experimented with custom command to generate the source files (which 
>>> did not work), and would have still
>>> left me with how to compile them with different -D flags.
> 
> Same kind of question has been asked on the ML recently,
> may be you can re-read the thread
> http://www.cmake.org/pipermail/cmake/2009-December/033813.html
> 

Or you can use CONFIGURE_FILE to create "wrappers" which #include the actual 
source file. If it's always the same flags, you can do it statically, using 
something like this:

wrap_foo.c:
/* -- */
/* clean up */
#ifdef DINT
#undef DINT
#endif
#ifdef DLONG
#undef DLONG
#endif

/* compile for int */
#define DINT
#include "foo.c"
#undef DINT

/* compile for long */
#define DLONG
#include "foo.c"
#endif 
/* -- */

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


[CMake] compiling single source with different flags

2009-12-29 Thread Bart
Hi,

I'm trying to find a way to build a library with two different instances of the 
same source file.
for example I would like to compile foo.c with -DDINT into foo_int.o and with 
-DDLONG into foo_long.o
and have both objects added to the same library libfoo.a

I have experimented with custom command to generate the source files (which did 
not work), and would have still
left me with how to compile them with different -D flags.

So I would be interested to hear how I would be able to do this.

Thanks,

Bart
___
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] Policy Scope Question

2009-12-29 Thread Richard Wackerbarth
I have a question about policy CMP0011.

I have:
$ cat Call_process_dashboard.cmake 

# Call process_dashboard

# These files are maintained by Richard Wackerbarth
set(maintainer_email_account "Richard")
set(maintainer_email_domain "NFSNet.org")

IF(COMMAND CMAKE_POLICY)
  CMAKE_POLICY(SET CMP0011 NEW)
ENDIF(COMMAND CMAKE_POLICY)

process_dashboard (${project} ${branch})

$

>From my reading of its definition, setting CMP0011 to NEW should suppress all 
>complaints about changes to policy in any subordinate scopes.
Thus shouldn't any policy changes make within process_dashboard() be OK and not 
generate any warning?

Richard
___
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 file in build directory

2009-12-29 Thread Hicham Mouline
Hello,

I am writing software that uses boost and Qt and other 3rd party libraries for 
win/mingw, win/msvc2008 and linux/gcc.
The location of the 3rd party header files is different on each of the boxes I 
compile on.

Is there a file to put in the build directory? Is such a file automatically 
read by cmake, or does it need to be included explicitly by the source dir 
CMakeLists.txt?

Does one call the find modules explicitly? or just define for e..g BOOSTROOT ?

regards,
___
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 file in build directory

2009-12-29 Thread John Drescher
On Tue, Dec 29, 2009 at 6:01 PM, Hicham Mouline  wrote:
> Hello,
>
> I am writing software that uses boost and Qt and other 3rd party libraries 
> for win/mingw, win/msvc2008 and linux/gcc.
> The location of the 3rd party header files is different on each of the boxes 
> I compile on.
>
> Is there a file to put in the build directory? Is such a file automatically 
> read by cmake, or does it need to be included explicitly by the source dir 
> CMakeLists.txt?
>
> Does one call the find modules explicitly? or just define for e..g BOOSTROOT ?
>

I call finders in my master CMakeLists.txt file and do not put any
files in any of the build trees for any of the compilers I use.

On windows (because there is no standard library install location) a
lot of times this means I need to either manually find the
dependencies when I run cmake-gui or define BOOST_ROOT, ITK_DIR ... in
my environment variables.

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] example how to find a library with PKG_CHECK_MODULES and FIND_PACKAGE_HANDLE_STANDARD_ARGS

2009-12-29 Thread Claus Klein

according to

Notes to authors of FindXXX.cmake files

We would like all FindXXX.cmake files to produce consistent variable  
names.


Please use the following consistent variable names for general use.

XXX_FOUND :
Set to false, or undefined, if we haven't found, or don't want to use  
XXX.

XXX_YYY_FOUND :
If False, optional YYY part of XXX sytem is not available.
XXX_INCLUDE_DIRS :
The final set of include directories listed in one variable for use by  
client code. This should not be a cache entry!

XXX_LIBRARIES :
The libraries to link against to use XXX. These should include full  
paths. This should not be a cache entry!

XXX_LIBRARY_DIRS : Optionally
The final set of library directories listed in one variable for use by  
client code. This should not be a cache entry!

XXX_DEFINITIONS :
Definitions to use when compiling code that uses XXX.
Note

This really shouldn't include options such as (-DHAS_JPEG) that a  
client source-code file uses to decide whether to #include .  
Too, it must not include any compiler flags like -O3 -Wall to be tool  
independent!

A FindXXX.cmake module will typically be loaded by the command:

FIND_PACKAGE(XXX [major[.minor[.patch[.tweak [EXACT]
 [QUIET] [[REQUIRED|COMPONENTS] [components...]])
If any version numbers are given to the command it will set the  
following variables before loading the module:


XXX_FIND_VERSION   = full requested version string
XXX_FIND_VERSION_MAJOR = major version if requested, else 0
XXX_FIND_VERSION_MINOR = minor version if requested, else 0
XXX_FIND_VERSION_PATCH = patch version if requested, else 0
XXX_FIND_VERSION_TWEAK = tweak version if requested, else 0
XXX_FIND_VERSION_COUNT = number of version components, 0 to 4
XXX_FIND_VERSION_EXACT = true if EXACT option was given
If the find module supports versioning it should locate a version of  
the package that is compatible with the version requested. If a  
compatible version of the package cannot be found the module should  
not report success. The version of the package found should be stored  
in "XXX_VERSION..." version variables documented by the module.


If the QUIET option is given to the command it will set the variable  
XXX_FIND_QUIETLY to true before loading the FindXXX.cmake module. If  
this variable is set the module should not complain about not being  
able to find the package.


If the REQUIRED option is given to the command it will set the  
variable XXX_FIND_REQUIRED to true before loading the FindXXX.cmake  
module. If this variable is set the module should issue a FATAL_ERROR  
if the package cannot be found. For each package-specific component,  
say YYY, listed after the REQUIRED option a  
variableXXX_FIND_REQUIRED_YYY to true.


The set of components listed after either the REQUIRED option or the  
COMPONENTS option will be specified in a XXX_FIND_COMPONENTS variable.  
This can be used by theFindXXX.cmake module to determine which sub- 
components of the package must be found.


If neither the QUIET nor REQUIRED options are given then the  
FindXXX.cmake module should look for the package and complain without  
error if the module is not found.


Tip

To get this behaviour you can use the  
FIND_PACKAGE_HANDLE_STANDARD_ARGS() macro, as an example see  
FindLibSmi.cmake.

# - Find LIBSMI
# Find the native LIBSMI includes and library
# This module defines
#  LIBSMI_INCLUDE_DIR, where to find smi.h, etc.
#  LIBSMI_LIBRARY, the LIBSMI library with full path.
#  LIBSMI_FOUND, If false, do not try to use LIBSMI.
# also defined, but not for general use are
#  LIBSMI_LIBRARIES, The libraries needed to use LIBSMI.
#  LIBSMI_LIBRARY_DIRS, where to find the LIBSMI library.
#  LIBSMI_DEFINITIONS - You should add_definitons($ 
{LIBSMI_DEFINITIONS}) before
#   compiling code that includes netsnmp library  
files.


INCLUDE(FindPkgConfig)
IF (PKG_CONFIG_FOUND)
  IF (LIBSMI_FIND_REQUIRED AND LIBSMI_FIND_VERSION)
SET(_PACKAGE_ARGS libsmi>=${LIBSMI_FIND_VERSION} REQUIRED)
  else ()
SET(_PACKAGE_ARGS libsmi)
  ENDIF ()
  PKG_CHECK_MODULES(LIBSMI ${_PACKAGE_ARGS})
ENDIF (PKG_CONFIG_FOUND)
SET(LIBSMI_DEFINITIONS ${LIBSMI_CFLAGS_OTHER})

FIND_PATH(LIBSMI_INCLUDE_DIR smi.h HINTS ${LIBSMI_INCLUDE_DIRS})

FIND_LIBRARY(LIBSMI_LIBRARY NAMES smi HINTS ${LIBSMI_LIBRARY_DIRS})
IF (NOT PKG_CONFIG_FOUND)
  SET(LIBSMI_LIBRARIES smi)
  GET_FILENAME_COMPONENT(LIBSMI_LIBRARY_DIRS ${LIBSMI_LIBRARY} PATH)
ENDIF (NOT PKG_CONFIG_FOUND)

# handle the QUIETLY and REQUIRED arguments and set LIBSMI_FOUND to  
TRUE if all

# listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSMI DEFAULT_MSG LIBSMI_LIBRARY  
LIBSMI_INCLUDE_DIR

LIBSMI_LIBRARIES LIBSMI_LIBRARY_DIRS)
MARK_AS_ADVANCED(LIBSMI_LIBRARY LIBSMI_INCLUDE_DIR
LIBSMI_LIBRARIES LIBSMI_LIBRARY_DIRS LIBSMI_DEFINITIONS)




I have tried to get the most of the information availabl

Re: [CMake] compiling single source with different flags

2009-12-29 Thread Bart
Thanks for those suggestions, I was on that path, but I can not get it to work 
properly:

foo$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bart/foo
foo$ make
Scanning dependencies of target foo
make[2]: *** No rule to make target ` /home/bart/foo/foo_int.c', needed by 
`CMakeFiles/foo.dir/_/home/bart/foo/foo_int.c.o'.  Stop.
make[1]: *** [CMakeFiles/foo.dir/all] Error 2
make: *** [all] Error 2
foo$ ls foo_int.c 
foo_int.c
foo$ 


---
File: CMakeLists.txt
---
PROJECT(foo)

# There will be more than one source file..
SET(LIBSOURCES foo)

foreach(libsrc ${LIBSOURCES})

set(DST_I "${CMAKE_CURRENT_SOURCE_DIR}/${libsrc}_int.c")
set(DST_L "${CMAKE_CURRENT_SOURCE_DIR}/${libsrc}_long.c")

set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/${libsrc}.c")

CONFIGURE_FILE(${SRC} ${DST_I} COPYONLY)
CONFIGURE_FILE(${SRC} ${DST_L} COPYONLY)

SET(LIBSOURCES_I "${LIBSOURCES_I} ${DST_I}")
SET(LIBSOURCES_L "${LIBSOURCES_L} ${DST_L}")

endforeach(libsrc)

SET_SOURCE_FILES_PROPERTIES({LIBSOURCES_I} PROPERTIES COMPILE_FLAGS "-DDINT")
SET_SOURCE_FILES_PROPERTIES({LIBSOURCES_L} PROPERTIES COMPILE_FLAGS "-DDLONG")
SET_SOURCE_FILES_PROPERTIES(${LIBSOURCES_I} PROPERTIES GENERATED true)
SET_SOURCE_FILES_PROPERTIES(${LIBSOURCES_L} PROPERTIES GENERATED true)

ADD_LIBRARY( foo ${LIBSOURCES_I} ${LIBSOURCES_L})

If I remove the generated property lines, cmake can not find the generated 
source files, either way there is 
a problem with the dependencies as generated from my CMakeList.

Thanks for the help.



On Dec 29, 2009, at 12:52, Michael Wild wrote:

> 
> On 29. Dec, 2009, at 21:44 , Eric Noulard wrote:
> 
>> 2009/12/29 Richard Wackerbarth :
>>> Not as a "real" solution, but more as a "workaround", you could create a 
>>> "derived source file" which is just a copy of the source file and then you 
>>> would have two separate files to be compiled with the appropriate flags.
>> 
>> That's one solution, see below for more information.
>> 
>>> On Dec 29, 2009, at 2:22 PM, Bart wrote:
>>> 
 Hi,
 
 I'm trying to find a way to build a library with two different instances 
 of the same source file.
 for example I would like to compile foo.c with -DDINT into foo_int.o and 
 with -DDLONG into foo_long.o
 and have both objects added to the same library libfoo.a
 
 I have experimented with custom command to generate the source files 
 (which did not work), and would have still
 left me with how to compile them with different -D flags.
>> 
>> Same kind of question has been asked on the ML recently,
>> may be you can re-read the thread
>> http://www.cmake.org/pipermail/cmake/2009-December/033813.html
>> 
> 
> Or you can use CONFIGURE_FILE to create "wrappers" which #include the actual 
> source file. If it's always the same flags, you can do it statically, using 
> something like this:
> 
> wrap_foo.c:
> /* -- */
> /* clean up */
> #ifdef DINT
> #undef DINT
> #endif
> #ifdef DLONG
> #undef DLONG
> #endif
> 
> /* compile for int */
> #define DINT
> #include "foo.c"
> #undef DINT
> 
> /* compile for long */
> #define DLONG
> #include "foo.c"
> #endif 
> /* -- */
> 
> Michael
> 
> ___
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> 

___
Powered by www.kitware.com

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

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

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

[CMake] Dependency scanning for non-supported languages?

2009-12-29 Thread Talin
What's the recommended way in CMake to do automated dependency generation
for languages that aren't directly supported by CMake? Suppose my compiler
generates an output file which contains a list of all the source files that
were used to make it, and I have some tool that can extract this
information. Is there some way I can get CMake to use this information in
subsequent builds?

-- 
-- Talin
___
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] Question about dependencies and paths

2009-12-29 Thread Talin
I've got a problem that has been vexing me for several months: It seems that
when I create a custom rule using add_custom_command, the DEPENDS clause
sometimes works and sometimes doesn't, and I can't figure out why.

Here's what my custom rule looks like:

  # Link with stdlib
  string(REGEX REPLACE ".tart\$" ".s" ASM_FILE "${SRC_FILE}")
  add_custom_command(OUTPUT ${ASM_FILE}
  COMMAND tartln -disable-fp-elim -filetype=asm ${TARTLN_OPTIONS}
${BC_FILE}
  "${PROJECT_BINARY_DIR}/stdlib/stdlib.bc"
  "${PROJECT_BINARY_DIR}/libext/testing/testing.lib.bc"
  DEPENDS "${BC_FILE}" tartln stdlib testing.lib
  COMMENT "Linking Tart bitcode file ${BC_FILE}")

Now, the targets 'stdlib' and 'testing.lib' are almost identical in
definition, however when I attempt to execute this rule it complains that it
can't find a rule to build 'testing.lib'. However, I can make both stdlib
and testing.lib manually by typing "make stdlib" or "make testing.lib"
respectively on the command line. So I know that both targets work.

The only significant difference between the two targets, as far as I can
tell, is that the testing.lib target is one level deeper in the build
hierarchy. That is, in my top-level CMakeLists.txt file, I include the
subdirectories "stdlib/" and "libext/testing/", which contain the
CMakeLists.txt for the two libraries.

I've tried putting $PROJECT_BINARY_DIR and $CMAKE_BINARY_DIR in front of
testing.lib, neither of which seems to make any difference. I've also tried
depending on the actual build product (testing.lib.bc) rather than the
abstract target testing.lib. Still no luck.

Can anyone suggest something else to try?

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