cmake 从入门到放弃

发布时间:2024-12-11 05:27

编程入门书籍《Python编程:从入门到实践》 #生活乐趣# #阅读推荐#

最新推荐文章于 2024-05-23 21:40:50 发布

gooogleman 于 2019-10-22 20:27:31 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

    以前在Linux下看过一些auto make 工具生成的Makefile,感觉生成的Makefile有一个原则,就是死命让人看不懂,显得很高深莫测,我不甘心,一些网友又给我推荐cmake,搜索一下果然是吹的神乎其技,并且说大型工程,自己手工写Makefile的人就是SB。于是我就整起来,开始在windows下整,遇到一些问题始终很奇怪,解决不了,于是还是在ubuntu下来搞吧。

        sudo apt-get install cmake 安装即可

    于是随便整一个只有main 函数的一个c文件,修改 CMakeLists.txt进行编译,提示No CMAKE_CXX_COMPILER could be found

通过:

sudo apt-get update

sudo apt-get install -y build-essential

解决了,cmake 后生成了Makefile ,执行make 也能生成可执行文件,不过打开Makefile一看,我的神啊,就一个main 函数,居然生成这么多。。。。。。

default_target: all

.PHONY : default_target

.NOTPARALLEL:

.SUFFIXES:

SUFFIXES =

.SUFFIXES: .hpux_make_needs_suffix_list

$(VERBOSE).SILENT:

cmake_force:

.PHONY : cmake_force

SHELL = /bin/sh

CMAKE_COMMAND = /usr/bin/cmake

RM = /usr/bin/cmake -E remove -f

EQUALS = =

CMAKE_SOURCE_DIR = /home/gooogleman/test/test_code/cmake_test

CMAKE_BINARY_DIR = /home/gooogleman/test/test_code/cmake_test/build

rebuild_cache:

@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."

/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)

.PHONY : rebuild_cache

rebuild_cache/fast: rebuild_cache

.PHONY : rebuild_cache/fast

edit_cache:

@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."

/usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.

.PHONY : edit_cache

edit_cache/fast: edit_cache

.PHONY : edit_cache/fast

all: cmake_check_build_system

$(CMAKE_COMMAND) -E cmake_progress_start /home/gooogleman/test/test_code/cmake_test/build/CMakeFiles /home/gooogleman/test/test_code/cmake_test/build/CMakeFiles/progress.marks

$(MAKE) -f CMakeFiles/Makefile2 all

$(CMAKE_COMMAND) -E cmake_progress_start /home/gooogleman/test/test_code/cmake_test/build/CMakeFiles 0

.PHONY : all

clean:

$(MAKE) -f CMakeFiles/Makefile2 clean

.PHONY : clean

clean/fast: clean

.PHONY : clean/fast

preinstall: all

$(MAKE) -f CMakeFiles/Makefile2 preinstall

.PHONY : preinstall

preinstall/fast:

$(MAKE) -f CMakeFiles/Makefile2 preinstall

.PHONY : preinstall/fast

depend:

$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1

.PHONY : depend

cmake_test: cmake_check_build_system

$(MAKE) -f CMakeFiles/Makefile2 cmake_test

.PHONY : cmake_test

cmake_test/fast:

$(MAKE) -f CMakeFiles/cmake_test.dir/build.make CMakeFiles/cmake_test.dir/build

.PHONY : cmake_test/fast

align.o: align.c.o

.PHONY : align.o

align.c.o:

$(MAKE) -f CMakeFiles/cmake_test.dir/build.make CMakeFiles/cmake_test.dir/align.c.o

.PHONY : align.c.o

align.i: align.c.i

.PHONY : align.i

align.c.i:

$(MAKE) -f CMakeFiles/cmake_test.dir/build.make CMakeFiles/cmake_test.dir/align.c.i

.PHONY : align.c.i

align.s: align.c.s

.PHONY : align.s

align.c.s:

$(MAKE) -f CMakeFiles/cmake_test.dir/build.make CMakeFiles/cmake_test.dir/align.c.s

.PHONY : align.c.s

help:

@echo "The following are some of the valid targets for this Makefile:"

@echo "... all (the default if no target is provided)"

@echo "... clean"

@echo "... depend"

@echo "... rebuild_cache"

@echo "... edit_cache"

@echo "... cmake_test"

@echo "... align.o"

@echo "... align.i"

@echo "... align.s"

.PHONY : help

cmake_check_build_system:

$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0

.PHONY : cmake_check_build_system

        过于复杂,要知道Linux 这么大的代码,也是没这么晦涩的,也不智能,不能用,放弃!看来还是自己老老实实写Makefile改善,写好框架就简单了。

网址:cmake 从入门到放弃 https://www.yuejiaxmz.com/news/view/440858

相关内容

数字生活20181222游戏攻略,从入门到放弃
卡片相机,从了解到放弃
spark从入门到放弃二十一:Spark 性能优化(4)对多次使用的RDD进行持久化或者checkpoint
纸板手工制作:从废弃到奇迹的创意之旅
从废弃到珍宝:垃圾的华丽蜕变
黑客攻防从入门到精通【全本
冥想初探:从入门到沉浸的宁静之旅
智能家居技术入门:从小白到专家
黑客攻防实战从入门到精通【全本
源码编译安装LAMP

随便看看