Mon premier fichier CMakeLists.txt

CMakeLists.txt 文件:

project (test2)

set (src
	${CMAKE_CURRENT_SOURCE_DIR}/test2.cpp
)

add_executable(test2
	${src}
)

fichier test2.cpp:

#include <stdio.h>

int main(){
	
	printf ("cmakelist.txt生成的可执行文件\n");
	fflush(stdout);
	return 0;
}

La mise en place d'un fichier de construction dans le répertoire fichier CMakeLists.txt et passez au fichier suivant build, exécutez la commande suivante:

cmake ..
make

Exécutez le programme exécutable résultant:

./test2
Publié 92 articles originaux · louange gagné 2 · Vues 3404

Je suppose que tu aimes

Origine blog.csdn.net/zxc120389574/article/details/105310396
conseillé
Classement