Boost.CMake's boost_add_executable
Hi, I've read http://svn.boost.org/trac/boost/wiki/CMakeAddExecutable and try to use it - and it doesn't work correct. This macros isn't used in the boost cmake build (in real there isn't a wave example as the web page promised)! Anyway, I've got the linker error: /usr/bin/ld: cannot find -lboost_program_options-static It should look for libboost_program_options-gcc41-mt-1_34! The part responsible is at tools/build/CMake/BoostCore.cmake: else (LIB MATCHES ".*-.*") # The user has given the name of just the library target, # e.g., "boost_filesystem". We add on the appropriate variant # name(s). list(APPEND THIS_EXE_ACTUAL_DEPENDS "${LIB}${VARIANT_TARGET_NAME}") list(APPEND THIS_EXE_RELEASE_ACTUAL_DEPENDS "${LIB}${RELEASE_VARIANT_TARGET_NAME}") list(APPEND THIS_EXE_DEBUG_ACTUAL_DEPENDS "${LIB}${DEBUG_VARIANT_TARGET_NAME}") endif (LIB MATCHES ".*-.*") using: boost_add_executable(... DEPENDS boost_program_options-gcc41-mt-1_34 ... ) works! Did I something wrong or is there an error inside boost's BoostConfig.cmake? Thanks, Olaf
On Aug 28, 2007, at 2:56 PM, ope wrote:
I've read http://svn.boost.org/trac/boost/wiki/CMakeAddExecutable and try to use it - and it doesn't work correct. This macros isn't used in the boost cmake build (in real there isn't a wave example as the web page promised)!
It's right here: http://svn.boost.org/trac/boost/browser/sandbox-branches/boost-cmake/ boost_1_34_0/tools/wave/CMakeLists.txt boost_add_executable is used in several places throughout the Boost CMake branch, including the regression testing.
Anyway, I've got the linker error: /usr/bin/ld: cannot find -lboost_program_options-static
It should look for libboost_program_options-gcc41-mt-1_34! The part responsible is at tools/build/CMake/BoostCore.cmake:
else (LIB MATCHES ".*-.*") # The user has given the name of just the library target, # e.g., "boost_filesystem". We add on the appropriate variant # name(s). list(APPEND THIS_EXE_ACTUAL_DEPENDS "${LIB}$ {VARIANT_TARGET_NAME}") list(APPEND THIS_EXE_RELEASE_ACTUAL_DEPENDS "${LIB}${RELEASE_VARIANT_TARGET_NAME}") list(APPEND THIS_EXE_DEBUG_ACTUAL_DEPENDS "${LIB}${DEBUG_VARIANT_TARGET_NAME}") endif (LIB MATCHES ".*-.*")
using:
boost_add_executable(... DEPENDS boost_program_options-gcc41-mt-1_34 ... )
works!
Did I something wrong or is there an error inside boost's BoostConfig.cmake?
It sounds like an error in the Boost CMake code. A few quick questions: - Are you using the latest from https://svn.boost.org/svn/boost/ sandbox-branches/boost-cmake/boost_1_34_0 ? - Which version of CMake are you using? - Do you recall which CMake options you changed? The Boost CMake work is still in a rather preliminary state, but it typically builds Boost out of the box without this kind of problem. - Doug
Hi Doug,
It's right here:
http://svn.boost.org/trac/boost/browser/sandbox-branches/boost-cmake/ boost_1_34_0/tools/wave/CMakeLists.txt
I wasn't very carefully, you are in right - there are: $ find . -name \*.txt -exec egrep -i -H boost_add_executable {} \; ./tools/wave/CMakeLists.txt:boost_add_executable(wave cpp.cpp ./tools/quickbook/CMakeLists.txt:boost_add_executable(quickbook
boost_add_executable is used in several places throughout the Boost CMake branch, including the regression testing.
boost_add_executable(... DEPENDS boost_program_options-gcc41-mt-1_34 ... )
works!
Did I something wrong or is there an error inside boost's BoostConfig.cmake?
It sounds like an error in the Boost CMake code. A few quick questions: - Are you using the latest from https://svn.boost.org/svn/boost/ sandbox-branches/boost-cmake/boost_1_34_0 ?
Yes: $ svn update Revision 39052.
- Which version of CMake are you using?
cmake version 2.4-patch 7
- Do you recall which CMake options you changed?
No changes; boost/build/libs/wave$ make [ 11%] Built target boost_filesystem-mt-shared [ 22%] Built target boost_wave-mt-shared [ 22%] Built target boost_filesystem-mt-shared-debug [ 33%] Built target boost_wave-mt-shared-debug [ 44%] Built target boost_wave-mt-static [ 55%] Built target boost_wave-mt-static-debug [ 55%] Built target boost_filesystem-shared [ 66%] Built target boost_wave-shared [ 77%] Built target boost_filesystem-shared-debug [ 88%] Built target boost_wave-shared-debug [100%] Built target boost_wave-static [100%] Built target boost_wave-static-debug But there isn't a wave exe created: $ ll ../../../build/bin/ insgesamt 12K drwxr-xr-x 3 opetzold opetzold 4,0K 2007-08-29 18:30 . drwxr-xr-x 7 opetzold opetzold 4,0K 2007-08-29 18:30 .. drwxr-xr-x 61 opetzold opetzold 4,0K 2007-08-29 18:30 tests Maybe I have to build all libs? Regards, Olaf
On Wed, 2007-08-29 at 21:21 +0200, ope wrote:
boost/build/libs/wave$ make [ 11%] Built target boost_filesystem-mt-shared [ 22%] Built target boost_wave-mt-shared [ 22%] Built target boost_filesystem-mt-shared-debug [ 33%] Built target boost_wave-mt-shared-debug [ 44%] Built target boost_wave-mt-static [ 55%] Built target boost_wave-mt-static-debug [ 55%] Built target boost_filesystem-shared [ 66%] Built target boost_wave-shared [ 77%] Built target boost_filesystem-shared-debug [ 88%] Built target boost_wave-shared-debug [100%] Built target boost_wave-static [100%] Built target boost_wave-static-debug
But there isn't a wave exe created:
$ ll ../../../build/bin/ insgesamt 12K drwxr-xr-x 3 opetzold opetzold 4,0K 2007-08-29 18:30 . drwxr-xr-x 7 opetzold opetzold 4,0K 2007-08-29 18:30 .. drwxr-xr-x 61 opetzold opetzold 4,0K 2007-08-29 18:30 tests
Maybe I have to build all libs?
Yes, that's it. The "wave" executable is actually built from the "tools" subdirectory, so you'll either need to build from within "tools" or build all libraries and tools from the top-level. - Doug
Maybe I have to build all libs?
Yes, that's it. The "wave" executable is actually built from the "tools" subdirectory, so you'll either need to build from within "tools" or build all libraries and tools from the top-level.
$ make [ 60%] Built target boost_serialization-static [ 80%] Built target boost_wave-static [ 80%] Built target boost_filesystem-static [ 80%] Built target boost_program_options-static [100%] Built target wave $ ldd ../../bin/wave libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e49000) libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7e24000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e18000) libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7cd0000) /lib/ld-linux.so.2 (0xb7f51000) So it's static linked, well. I have to go more into the deep. I adapted the cmake macros (I assume 1:1) for my project .... Thanks, Olaf
On Aug 30, 2007, at 12:47 PM, ope wrote:
Maybe I have to build all libs?
Yes, that's it. The "wave" executable is actually built from the "tools" subdirectory, so you'll either need to build from within "tools" or build all libraries and tools from the top-level.
$ make [ 60%] Built target boost_serialization-static [ 80%] Built target boost_wave-static [ 80%] Built target boost_filesystem-static [ 80%] Built target boost_program_options-static [100%] Built target wave
$ ldd ../../bin/wave libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e49000) libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7e24000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e18000) libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7cd0000) /lib/ld-linux.so.2 (0xb7f51000)
So it's static linked, well. I have to go more into the deep. I adapted the cmake macros (I assume 1:1) for my project ....
bjam statically links wave, so we did the same thing in CMake. Frankly, I'd prefer that we used dynamic linking wherever possible, because it would save a *lot* of space. - Doug
participants (3)
-
Doug Gregor
-
Douglas Gregor
-
ope