[CMake] CMake adds lib prefix to library. Bug?

2010-11-23 Thread Adam J Richardson
Hi list.

Not sure if this is a bug or something stupid I've done. On several
Windows build environments (two XP, two 7, this happens with 2.8.2 and
2.8.3), I'm getting the error:

c:/compilers/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: 
cannot find -llibodbc32

That's clear enough. It's also clear what the problem is: there is no
liblibodbc32.a in my environment. There is however a libodbc32.a, which
I would expect it to pick up.

With VERBOSE=1, make gives me a long g++ command ending with:

... -Wl,-Bstatic -llibodbc32 -Wl,-Bdynamic -lkernel32 -luser32 -lgdi32
-lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

Which is correct apart from the -llibodbc32 part. (I'm not entirely
clear on why CMake felt it necessary to specify that it's a static lib
when it didn't with the previous ones.)

I've debugged my FindODBC.cmake with message(STATUS ${blah})
instructions and it returns odbc32, which is correct.

So my question is: why is CMake adding an extra lib? I can work
around it for now, but I'd like to solve this one properly.

Thanks,
Adam J Richardson



CMakeLists.txt snippet:

if (ODBC_FOUND)
   set(T_LIBS ${T_LIBS} ${ODBC_LIBRARIES})
#   message(STATUS ODBC: ${ODBC_LIBRARIES})
else()
   set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -DNO_ODBC=1)
   message(STATUS ODBC not found, omitting from build.)
endif()

FindODBC.cmake sans comments:

SET( ODBC_FOUND 0 )
FIND_PATH(ODBC_INCLUDE_DIRECTORIES sql.h
  DOC Specify the directory containing sql.h.
)
FIND_LIBRARY( ODBC_LIBRARIES 
  NAMES iodbc odbc odbcinst odbc32
  DOC Specify the ODBC driver manager library here.
)
IF (ODBC_LIBRARIES)
  IF (ODBC_INCLUDE_DIRECTORIES)
SET( ODBC_FOUND 1 )
  ENDIF (ODBC_INCLUDE_DIRECTORIES)
ENDIF (ODBC_LIBRARIES)
MARK_AS_ADVANCED( ODBC_FOUND ODBC_LIBRARY ODBC_LIBRARIES ODBC_EXTRA_LIBRARIES 
ODBC_INCLUDE_DIRECTORIES )


signature.asc
Description: PGP signature
___
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] Extra include/lib paths - multiple entries

2010-11-17 Thread Adam J Richardson
Hi list,

Is this a correct specification for multiple include/lib paths in
environment variables? If not, what should I use instead? Sometimes it
seems to work, other times not...

  CMAKE_INCLUDE_PATH=C:/Compilers/Includes;C:/Compilers/MinGW/include
  CMAKE_LIBRARY_PATH=C:/Compilers/Libs;C:/Compilers/MinGW/lib

Thanks,
Adam J Richardson


signature.asc
Description: PGP signature
___
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] Bug fix requests for the *next* release of CMake...

2010-11-11 Thread Adam J Richardson
  If I have ignored one of your non-bug-issue points from a reply to
  this thread, it's because it was not a bug number. If you still have
  an issue, open a bug and reply here with its number or start a new
  thread!!

Argh. Fine. Here's a bug number: #0011445

 Let me know if you or somebody you know wants to be that volunteer.

Unfortunately I have my fingers in way too many pies to find time to be
a maintainer. :( 


signature.asc
Description: PGP signature
___
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] fun with Boost - swap absolute library path for -L and -l?

2010-11-11 Thread Adam J Richardson
On Thu, 11 Nov 2010 07:07:48 -0500
cmake-requ...@cmake.org wrote:

 Any help is greatly appreciated!

I'd help if I could. Unfortunately I'm still stuck on this. Usually I
can work around a problem given enough time, but this is a real
stumper. Actually I do have a suggestion (see below) but it's kind of
ugly.

 Adam J Richardson fat...@... writes:
  (That is, if I manually separate
  C:\Compilers\Libs\libboost_thread-mgw44-mt-1_44.a into
  -LC:\Compilers\Libs -lboost_thread-mgw44-mt-1_44.)
  
  Is there a way to have CMake do this by itself and not use absolute
  paths? I've tried setting CMP0003 to OLD but it doesn't seem to do
  that.  

 I've run into the same problem recently.

 It seems to be because the underlying find_library() call returns full
 paths instead of just library names.  Linking against libraries as
 inputs (specifying as full paths) instead of libraries (specifying
 name with -l) seems to lead to inconsistent results on different
 platforms.

Is this actually a CMake bug? Just after posting it occurred to me that
this might be a MinGW bug. Shouldn't g++ find the library whether you
give it C:\Compilers\Libs\libboost_thread-mgw44-mt-1_44.a or
-LC:\Compilers\Libs -lboost_thread-mgw44-mt-1_44?

 The FindBoost script does set a Boost_LIBRARY_DIRS variable, so you
 can use link_directories() to basically add the -L option.  But I'm at
 a loss as to how to properly set the -l options.

I suppose you could manually

set_target_properties(targ PROPERTIES LINK_FLAGS ${LINK_FLAGS}
-lboost_thread)

but that seems a little hackish. No, I'll poke some more at g++ and see
what I can come up with.

Regards,
Adam J Richardson


signature.asc
Description: PGP signature
___
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] fun with Boost - swap absolute library path for -L and -l?

2010-11-11 Thread Adam J Richardson
 On Thu, 11 Nov 2010 07:07:48 -0500
 cmake-requ...@cmake.org wrote:
 
  Any help is greatly appreciated!
 
 I'd help if I could. Unfortunately I'm still stuck on this. Usually I
 can work around a problem given enough time, but this is a real
 stumper. Actually I do have a suggestion (see below) but it's kind of
 ugly.

This always happens. Declare complete stumpitude and almost immediately
find a solution. This is the problem: I'm linking statically and
boost_thread wants to link dynamically.

The clue is in the first error in the build log: undefined reference
to `_imp___blablabla'. The _imp___ part gives it away. The fix is to
define BOOST_THREAD_USE_LIB in your CMakeLists.txt:

set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -DBOOST_THREAD_USE_LIB=1)

I haven't tested it, but it builds without complaint now.

HtH,
Adam J Richardson


signature.asc
Description: PGP signature
___
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] Bug fix requests for the *next* release of CMake...

2010-11-05 Thread Adam J Richardson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi David,

 Replies requested.

CMake is already pretty awesome from my POV, but since you ask...

 Replies on this thread should just be a collector for bug numbers.

Afraid I don't have a bug number, but I can explain quickly.

 If you have a particular issue that you think should be fixed for
 inclusion in 2.8.4, please bring it up now.

Could you guys have a chat with the Boost guys and fix the future
safety of FindBoost.cmake somehow? Fiddling with ADDITIONAL_VERSIONS
is really a pain on a build farm.

Oh, and include Mateusz Loskot's FindODBC.cmake in the release?

Thanks,
Adam J Richardson
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzT3GwACgkQSUH6dLOqvqlyOQCfaC2+BL+jkULzetoh3bduWoHU
tmMAniddpSiMW4KpeRjpS0me9C+3RNjm
=4TE7
-END PGP SIGNATURE-
___
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] Linking Boost on Linux on 64bit host and 32bit target

2010-11-04 Thread Adam J Richardson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, 04 Nov 2010 04:35:57 -0400
cmake-requ...@cmake.org wrote:
 Hi all~

Hi Kent.

 I have a project using Boost that should compile for both 64bit and
 32bit on a 64bit host.  This works fine for a 64bit target, but I
 can't get this to work for a 32bit target.

I'm having problems linking Boost too. But enough about me.

 In order to compile for 32bit on a 64bit host, I have a -D parameter
 called BUILD64.  Here is my logic to initialize this var:
 
 if( WIN32 )
   set( BUILD64 ${CMAKE_CL_64} )
 else()
   option( BUILD64 Build a 64-bit product OFF )
   if( BUILD64 )
   message( STATUS 64-bit build )
   endif( )
 endif()

Are you sure this logic is right? It looks very odd. Does CMake set
WIN32 for a 64-bit Windows toolchain? Didn't you say you were building
on Linux?

 The syntax for finding boost is thus:
 set( Boost_USE_MULTITHREADED ON )
 set( Boost_USE_STATIC_LIBS   ON )
 set( Boost_DETAILED_FAILURE_MSG   ON )
 # set( Boost_DEBUG ON )
 find_package( Boost 1.33.0 COMPONENTS program_options )

You don't set ADDITIONAL_VERSIONS. That's probably not the problem.
IIRC, it's:

set(Boost_ADDITIONAL_VERSIONS 1.44 1.44.0)

... if you wanted to try it anyway.

Regards,
Adam J Richardson
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzSgx0ACgkQSUH6dLOqvqmfKwCg6qttDVOXnpqHYoZwfjzUyHax
ubMAniQAF6EYxsIUYkqXPQiMwFxop6uB
=ngaQ
-END PGP SIGNATURE-
___
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] FindODBC.cmake

2010-11-02 Thread Adam J Richardson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, 01 Nov 2010 20:04:44 +
Mateusz Loskot mate...@loskot.net wrote:
  Thanks Mateusz, that's great! I only needed to add odbc32 to the
  list of library names (MinGW's OBDC implementation is in
  libodbc32.a).
 
 I'm glad it helped and thanks for the fix suggestion by the way.
 I have just updated my FindODBC.cmake :-)

Good news. I've tested the amended FindODBC.cmake on Ubuntu 32-bit and
Win32 and it works. Could it be submitted to CMake for inclusion in
Modules?
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzP2JIACgkQSUH6dLOqvqlZCwCfTCojXurhz2p7OkAYrmgrCqD3
SU8An0w8NQgwa2zj8xSVeu+h9scj6bbM
=cXh2
-END PGP SIGNATURE-
___
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] FindODBC.cmake

2010-11-01 Thread Adam J Richardson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi list,

Does anyone know of a good FindODBC.cmake I can grab from somewhere? My
Modules directory lacks one. :/

If not I'll write a quick one for inclusion in the new release. I'll
assume either Win32 standard or unixodbc is fine since they're
compatible with each other.

Thanks,
Adam J Richardson
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzOqQkACgkQSUH6dLOqvqkgrwCfR9lrKOZQOwVaqWC4tWJnFDd4
jlAAn0CE5RZy+3sLWFIkLdGv42jdHaR1
=0QA1
-END PGP SIGNATURE-
___
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] FindODBC.cmake

2010-11-01 Thread Adam J Richardson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, 01 Nov 2010 14:25:24 +
Mateusz Loskot mate...@loskot.net wrote:
 Hi,
 You may find the one in SOCI repo useful
 http://soci.git.sf.net/
 
 And go to src/cmake/modules

Thanks Mateusz, that's great! I only needed to add odbc32 to the list
of library names (MinGW's OBDC implementation is in libodbc32.a).
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzO3VEACgkQSUH6dLOqvqlcuACgl4nzrna/zg9R7NK9X2DHBJ3o
aq8AoN1b7OQeVZbfRc8X6nJAHe63OPuZ
=nbOL
-END PGP SIGNATURE-
___
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] fun with Boost - swap absolute library path for -L and -l?

2010-11-01 Thread Adam J Richardson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi list,

I'm having some fun making link errors with the help of Boost on Win32.

With a main.cc of:


#include boost/thread.hpp

int main(int, char **) {
   boost::thread t;
   return 0;
}


and a CMakeLists.txt of:


cmake_minimum_required(VERSION 2.8)
project(orrible)
add_executable(orrible orrible/main.cc)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_ADDITIONAL_VERSIONS 1.44 1.44.0)
find_package(Boost 1.38 REQUIRED COMPONENTS thread)
include_directories(${Boost_INCLUDE_DIR})
target_link_libraries(orrible ${Boost_LIBRARIES})


I can produce the error:


CMakeFiles/orrible.dir/orrible/main.cc.obj:main.cc:(.text+0x17): undefined refer
ence to `_imp___ZN5boost6threadC1Ev'
CMakeFiles/orrible.dir/orrible/main.cc.obj:main.cc:(.text+0x2a): undefined refer
ence to `_imp___ZN5boost6threadD1Ev'
collect2: ld returned 1 exit status
make[2]: *** [orrible.exe] Error 1
make[1]: *** [CMakeFiles/orrible.dir/all] Error 2
make: *** [all] Error 2


Making with VERBOSE=1, we see the command line:


C:\Compilers\MinGW\bin\g++.exe -Wl,@CMakeFiles\orrible.dir\objects1.rsp  -o
orrible.exe -Wl,--out-implib,liborrible.dll.a -Wl,--major-image-version,0,--mino
r-image-version,0  C:\Compilers\Libs\libboost_thread-mgw44-mt-1_44.a -lkernel32
- -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 
-ladv
api32


Oddly enough, it links without complaint if I manually change the
command line to:


C:\Compilers\MinGW\bin\g++.exe
- -Wl,@CMakeFiles\orrible.dir\objects1.rsp  -oorrible.exe
- -Wl,--out-implib,liborrible.dll.a
- -Wl,--major-image-version,0,--minor-image-version,0 -LC:\Compilers\Libs
- -lboost_thread-mgw44-mt-1_44 -lkernel32 -luser32 -lgdi32 -lwinspool
- -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32


(That is, if I manually separate
C:\Compilers\Libs\libboost_thread-mgw44-mt-1_44.a into
-LC:\Compilers\Libs -lboost_thread-mgw44-mt-1_44.)

Is there a way to have CMake do this by itself and not use absolute
paths? I've tried setting CMP0003 to OLD but it doesn't seem to do that.

Thanks,
Adam J Richardson
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzO7NQACgkQSUH6dLOqvqmM5QCgwAD9sffVFYn5/XxBD0t2KqxL
f7YAn0iOmlQ1C4OAvo/NiTVcN/Ox6sNX
=pzU7
-END PGP SIGNATURE-
___
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 hangs on new install

2010-10-28 Thread Adam J Richardson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 Message-ID:
 b870629719727b4ba82a6c06a31c29123119bf1...@hqmailsvr01.voltage.com

Hi Phil.

 Sono ideas nowhere nohow?

Well, I did have one idea. A wild stab in the dark, probably nothing
whatsoever to do with your issue. Apologies in advance for the low
quality of this complete guess.

 cmake -DCMAKE_TOOLCHAIN_FILE:string=%~dp0\zosport.cmake -GUnix
 Makefiles .\

You are building on Windows, yes? Whenever I try to use .\ in a
command prompt, batch file or command file on Windows, it does horrible
things. I have to substitute a full or partial path. Could this be the
issue?

Regards,
Adam J Richardson
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkzJMSoACgkQSUH6dLOqvqlOMwCdHXpEp/nIYGYd+u86GCx9PIoB
dYQAnjuKpOX44b0wsDKgQytuwGX7xxFG
=XlSY
-END PGP SIGNATURE-
___
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] config dependent defines

2010-10-18 Thread Adam J Richardson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 Your users will hate you for that, because they will not be able to
 override the compile-flags without modifying the CMakeLists.txt file.
 
 You can set the COMPILE_DEFINITIONS_DEBUG property on individual
 targets using SET_TARGET_PROPERTIES() or on directories with
 SET_DIRECTORY_PROPERTIES.

I've been meaning to ask, Michael. Exactly how would a user expect to
override the defaults without modifying the CMakeLists.txt file? Isn't
that the easiest way to override the defaults?

Is it because of the FORCE option they will hate him?

Regards,
Adam J Richardson
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAky8Cr8ACgkQSUH6dLOqvqnYUgCfbZB1KtewDVQ/ZMdPeeYDHD6V
KFoAn3M3nETZeJlnW8yLAYt4xq6Lq7sO
=ByUi
-END PGP SIGNATURE-
___
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