CMakeLists.txt:我没有得到任何可执行输出

问题描述 投票:0回答:1

我想转换这个命令行编译和构建:

g++ tutorial01.cpp -o tutorial01 -std=c++17 -I /usr/local/include/webkitgtk-4.1/webkit2 $(pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0)

进入 CMake 建筑:

使用此 CMakeLists.txt 文件: cmake_minimum_required(版本3.24) 项目(tutorial01 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)

set(export WEBKIT_DISABLE_COMPOSITING_MODE=1)

find_package(PkgConfig)
pkg_check_modules(gtk+-3.0 webkit2gtk-4.0)

add_executable(tutorial01 tutorial01.cpp)

target_compile_options(tutorial01 PUBLIC ${webkit2gtk-4.1_CFLAGS_OTHER} ${gtk+-3.0_CFLAGS_OTHER})
target_include_directories(tutorial01 PUBLIC ${webkit2gtk-4.1_INCLUDE_DIRS})



target_link_libraries(tutorial01 PUBLIC
    gtk+-3.0_LIBRARIES
    webkit2gtk-4.1_LIBRARIES
)

没有错误,但我没有得到可执行文件

tutorial01

raphy@raohy:~/tutorial_webkitgtk$ cmake -B build
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'webkit2gtk-4.0'
--   Found webkit2gtk-4.0, version 2.42.3
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/raphy/tutorial_webkitgtk/build


raphy@raohy:~/tutorial_webkitgtk/build$ ls -lah
total 48K
drwxrwxr-x 3 raphy raphy 4,0K dic 20 16:00 .
drwxrwxr-x 3 raphy raphy 4,0K dic 20 16:01 ..
-rw-rw-r-- 1 raphy raphy  24K dic 20 16:00 CMakeCache.txt
drwxrwxr-x 6 raphy raphy 4,0K dic 20 16:00 CMakeFiles
-rw-rw-r-- 1 raphy raphy 1,6K dic 20 16:00 cmake_install.cmake
-rw-rw-r-- 1 raphy raphy 5,3K dic 20 16:00 Makefile

raphy@raohy:~/tutorial_webkitgtk$ ls -lah
total 20K
drwxrwxr-x  3 raphy raphy 4,0K dic 20 16:01 .
drwxr-x--- 78 raphy raphy 4,0K dic 20 15:23 ..
drwxrwxr-x  3 raphy raphy 4,0K dic 20 16:00 build
-rw-rw-r--  1 raphy raphy  609 dic 20 16:00 CMakeLists.txt
-rw-rw-r--  1 raphy raphy 1,7K dic 20 13:41 tutorial01.cpp

为了生成可执行文件,我缺少什么?

c++ cmake pkg-config
1个回答
0
投票

我可以从您的评论中看到您已经尝试在构建文件夹中执行

make

尝试运行

cmake --build

© www.soinside.com 2019 - 2024. All rights reserved.