| 1 | = Building individual libraries with cmake = |
| 2 | |
| 3 | == help == |
| 4 | |
| 5 | In a configured cmake workspace, `make help` will display a list of available targets. Example: |
| 6 | {{{ |
| 7 | % make help |
| 8 | The following are some of the valid targets for this Makefile: |
| 9 | ... all (the default if no target is provided) |
| 10 | ... clean |
| 11 | ... depend |
| 12 | ... edit_cache |
| 13 | ... install |
| 14 | ... install/local |
| 15 | ... install/strip |
| 16 | ... list_install_components |
| 17 | ... package |
| 18 | ... package_source |
| 19 | ... rebuild_cache |
| 20 | ... boost_date_time |
| 21 | ... boost_date_time-mt-shared |
| 22 | ... boost_date_time-mt-shared-debug |
| 23 | ... boost_date_time-mt-static |
| 24 | ... boost_date_time-mt-static-debug |
| 25 | ... boost_date_time-shared |
| 26 | ... boost_date_time-shared-debug |
| 27 | ... boost_date_time-static |
| 28 | ... boost_date_time-static-debug |
| 29 | ... boost_filesystem |
| 30 | ... boost_filesystem-mt-shared |
| 31 | ... boost_filesystem-mt-shared-debug |
| 32 | ... boost_filesystem-mt-static |
| 33 | ... boost_filesystem-mt-static-debug |
| 34 | ... boost_filesystem-shared |
| 35 | ... boost_filesystem-shared-debug |
| 36 | ... boost_filesystem-static |
| 37 | ... boost_filesystem-static-debug |
| 38 | [etc] |
| 39 | }}} |
| 40 | |
| 41 | You can build any target by passing it as an argument: |
| 42 | |
| 43 | {{{ |
| 44 | % make boost_signals-static |
| 45 | [ 0%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/trackable.cpp.o |
| 46 | [ 0%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/connection.cpp.o |
| 47 | [100%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/named_slot_map.cpp.o |
| 48 | [100%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/signal_base.cpp.o |
| 49 | [100%] Building CXX object libs/signals/src/CMakeFiles/boost_signals-static.dir/slot.cpp.o |
| 50 | Linking CXX static library ../../../lib/libboost_signals-gcc41-1_35.a |
| 51 | [100%] Built target boost_signals-static |
| 52 | }}} |
| 53 | |
| 54 | == Preprocessing == |
| 55 | |
| 56 | In build directories corresponding to a source library containing a `CMakeLists.txt` containing a |
| 57 | `boost_add_library` invocation (e.g. build/libs/signals/src, build/libs/filesystem/src), |
| 58 | more detailed targets are available: |
| 59 | {{{ |
| 60 | % cd libs/signals/src |
| 61 | % make help |
| 62 | The following are some of the valid targets for this Makefile: |
| 63 | [many omitted] |
| 64 | ... signal_base.o |
| 65 | ... signal_base.i |
| 66 | ... signal_base.s |
| 67 | ... slot.o |
| 68 | ... slot.i |
| 69 | ... slot.s |
| 70 | }}} |
| 71 | |
| 72 | making `slot.i` will run `slot.cpp` through the preprocessor: |
| 73 | {{{ |
| 74 | % make slot.i |
| 75 | Preprocessing CXX source to CMakeFiles/boost_signals-mt-shared.dir/slot.cpp.i |
| 76 | }}} |
| 77 | If you are interested in the compiler flags, try enabling `CMAKE_VERBOSE_MAKEFILES` via `ccmake`, or just passing `VERBOSE=1` |
| 78 | on the command line: |
| 79 | {{{ |
| 80 | % make VERBOSE=1 slot.i |
| 81 | make[1]: Entering directory `/home/troy/Projects/boost/branches/CMake/Boost_1_35_0-build' |
| 82 | Preprocessing CXX source to CMakeFiles/boost_signals-mt-shared.dir/slot.cpp.i |
| 83 | cd /home/troy/Projects/boost/branches/CMake/Boost_1_35_0-build/libs/signals/src && /usr/bin/gcc-4.1 -DBOOST_ALL_NO_LIB=1 -DBOOST_SIGNALS_NO_LIB=1 -Dboost_signals_mt_shared_EXPORTS -fPIC -I/home/troy/Projects/boost/branches/CMake/Boost_1_35_0 -O3 -DNDEBUG -DBOOST_SIGNALS_DYN_LINK=1 -pthread -D_REENTRANT -E /home/troy/Projects/boost/branches/CMake/Boost_1_35_0/libs/signals/src/slot.cpp > CMakeFiles/boost_signals-mt-shared.dir/slot.cpp.i |
| 84 | }}} |
| 85 | |
| 86 | This may come in handy while we wait for c++0x to banish preprocessor metaprogramming. |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |