作者:yantian | 来源:互联网 | 2023-02-01 16:45
我是CMake的新手,我在使用CMake创建可执行文件时遇到问题.我正在尝试从单个CMakeLists.txt文件构建可执行文件和共享库.我的CMakeLists.txt如下:
cmake_minimum_required(VERSION 3.4.1)
project (TestService)
include_directories(
src/main/cpp/
libs/zlib/include/
)
add_library(libz SHARED IMPORTED)
set_target_properties(libz PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libs/zlib/libs/${ANDROID_ABI}/libz.so)
find_library(log-lib log)
add_executable(
test_utility
src/main/cpp/test_utility.cpp
src/main/cpp/storage.cpp
)
target_link_libraries(test_utility ${log-lib} libz)
add_library(
processor
SHARED
src/main/cpp/com_example_testservice.cpp
src/main/cpp/storage.cpp
)
target_link_libraries(processor libz ${log-lib})
然而,当我从命令行使用android studio/gradlew构建我的项目时,我只看到处理器创建了process.utility,从未创建test_utility可执行文件.我的CMakeLists.txt中有什么不对?