我的代码组织如下:
dataStructures/
和common/
的代码) build\
目录包含构建的目标。实际代码可以在这里看到:https://github.com/brainydexter/PublicCode/tree/master/cpp
截至目前,每个子目录中的CMakeLists.txt都构建了自己的共享库。最顶层的CMakeLists文件然后引用库
我启动cmake吐出make文件,调试符号如下:
cmake -DCMAKE_BUILD_TYPE = Debug ..
这只生成带有调试符号的main.cpp,但不会将构建类型传播给依赖的共享库。我怎么能在cmake中做到这一点?
我正在尝试在macosx上执行此操作。
当我运行make VERBOSE=1
时,输出似乎cmake正在生成带有调试符号的共享库:
cd /Users/priyank/pj/repo/PublicCode/cpp/build && /usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_depends "Unix Makefiles" /Users/priyank/pj/repo/PublicCode/cpp /Users/priyank/pj/repo/PublicCode/cpp/common /Users/priyank/pj/repo/Publi
make[2]: Leaving directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
make -f common/CMakeFiles/cppCommon.dir/build.make common/CMakeFiles/cppCommon.dir/build
make[2]: Entering directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
[ 11%] Building CXX object common/CMakeFiles/cppCommon.dir/src/utils.cpp.o
cd /Users/priyank/pj/repo/PublicCode/cpp/build/common && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DcppCommon_EXPORTS -g -fPIC -I/Users/priyank/pj/repo/PublicCode/cpp/common/include
[ 22%] Linking CXX shared library libcppCommon.dylib
cd /Users/priyank/pj/repo/PublicCode/cpp/build/common && /usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_link_script CMakeFiles/cppCommon.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -dynamiclib -Wl,-headerpad_max_install_names -o libcppCommon.dylib -install_name @rpath/libcppCommon.dylib CMakeFiles/cppCommon.dir/src/uti
make[2]: Leaving directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
[ 22%] Built target cppCommon
make -f dataStructures/CMakeFiles/cppDS.dir/build.make dataStructures/CMakeFiles/cppDS.dir/depend
make[2]: Entering directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
cd /Users/priyank/pj/repo/PublicCode/cpp/build && /usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_depends "Unix Makefiles" /Users/priyank/pj/repo/PublicCode/cpp /Users/priyank/pj/repo/PublicCode/cpp/dataStructures /Users/priyank/pj/re
make[2]: Leaving directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
make -f dataStructures/CMakeFiles/cppDS.dir/build.make dataStructures/CMakeFiles/cppDS.dir/build
make[2]: Entering directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
[ 33%] Building CXX object dataStructures/CMakeFiles/cppDS.dir/src/dsBinarySearchTree.cpp.o
cd /Users/priyank/pj/repo/PublicCode/cpp/build/dataStructures && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DcppDS_EXPORTS -g -fPIC -I/Users/priyank/pj/repo/PublicCode/cpp/dataStructur
[ 44%] Building CXX object dataStructures/CMakeFiles/cppDS.dir/src/dsLinkedList.cpp.o
cd /Users/priyank/pj/repo/PublicCode/cpp/build/dataStructures && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DcppDS_EXPORTS -g -fPIC -I/Users/priyank/pj/repo/PublicCode/cpp/dataStructur
[ 55%] Linking CXX shared library libcppDS.dylib
cd /Users/priyank/pj/repo/PublicCode/cpp/build/dataStructures && /usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_link_script CMakeFiles/cppDS.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -dynamiclib -Wl,-headerpad_max_install_names -o libcppDS.dylib -install_name @rpath/libcppDS.dylib CMakeFiles/cppDS.dir/src/dsBinarySearchT
make[2]: Leaving directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
[ 55%] Built target cppDS
make -f test/dataStructures/CMakeFiles/testCppDS.dir/build.make test/dataStructures/CMakeFiles/testCppDS.dir/depend
make[2]: Entering directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
cd /Users/priyank/pj/repo/PublicCode/cpp/build && /usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_depends "Unix Makefiles" /Users/priyank/pj/repo/PublicCode/cpp /Users/priyank/pj/repo/PublicCode/cpp/test/dataStructures /Users/priyank/
make[2]: Leaving directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
make -f test/dataStructures/CMakeFiles/testCppDS.dir/build.make test/dataStructures/CMakeFiles/testCppDS.dir/build
make[2]: Entering directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
[ 66%] Building CXX object test/dataStructures/CMakeFiles/testCppDS.dir/src/testDsLinkedList.cpp.o
cd /Users/priyank/pj/repo/PublicCode/cpp/build/test/dataStructures && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DtestCppDS_EXPORTS -g -fPIC -I/Users/priyank/pj/repo/PublicCode/cpp/tes
[ 77%] Linking CXX shared library libtestCppDS.dylib
cd /Users/priyank/pj/repo/PublicCode/cpp/build/test/dataStructures && /usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_link_script CMakeFiles/testCppDS.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -dynamiclib -Wl,-headerpad_max_install_names -o libtestCppDS.dylib -install_name @rpath/libtestCppDS.dylib CMakeFiles/testCppDS.dir/src/tes
make[2]: Leaving directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
[ 77%] Built target testCppDS
make -f CMakeFiles/execCpp.dir/build.make CMakeFiles/execCpp.dir/depend
make[2]: Entering directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
cd /Users/priyank/pj/repo/PublicCode/cpp/build && /usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_depends "Unix Makefiles" /Users/priyank/pj/repo/PublicCode/cpp /Users/priyank/pj/repo/PublicCode/cpp /Users/priyank/pj/repo/PublicCode/c
make[2]: Leaving directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
make -f CMakeFiles/execCpp.dir/build.make CMakeFiles/execCpp.dir/build
make[2]: Entering directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
[ 88%] Building CXX object CMakeFiles/execCpp.dir/main.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -I/Users/priyank/pj/repo/PublicCode/cpp/dataStructures/include -I/Users/priyank/pj/repo/PublicCode/cpp/common/include -I/Users/priyank/pj/
[100%] Linking CXX executable execCpp
/usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_link_script CMakeFiles/execCpp.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/execCpp.dir/main.cpp.o -o execCpp test/dataStructures/libtestCppDS.d
make[2]: Leaving directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
[100%] Built target execCpp
make[1]: Leaving directory '/Users/priyank/pj/repo/PublicCode/cpp/build'
/usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_progress_start /Users/priyank/pj/repo/PublicCode/cpp/build/CMakeFiles 0