使用/ include * .a静态库创建共享* .dll库

时间:2018-05-14 11:02:37

标签: c++ makefile cmake mingw msys2

我想使用* .a静态库

创建共享* .dll库

以下是我的CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
project(Projects)

set(CMAKE_CXX_STANDARD 11)

include_directories(../msys64/mingw64/include)
include_directories("../Program Files/Java/jdk1.8.0_151/include" "../Program Files/Java/jdk1.8.0_151/include/win32")
add_library(Projects1 SHARED main.cpp HelloWorld.cpp )

add_library(libgdal STATIC IMPORTED)
set_target_properties(libgdal PROPERTIES IMPORTED_LOCATION ../msys64/mingw64/lib/libgdal.a)
target_link_libraries(Projects1 A libgdal C )

它给我以下错误:

*** No rule to make target '../msys64/mingw64/lib/libgdal.a', needed by 'libProjects1.dll'.  Stop.

虽然当我尝试创建一个如下所示的静态库更改时,它可以正常工作。

 add_library(Projects1 STATIC main.cpp HelloWorld.cpp )

我不确定如何使用静态库创建共享库

感谢您提前获得所有帮助

0 个答案:

没有答案