CMakeLists.txt
cmake_minimum_required(VERSION 3.16) set(CMAKE_CXX_STANDARD 11) project(test) set(SRC src/HelloWorld.cpp) # 配置cpp源文件到SRC变量中 set(EXECUTABLE_OUTPUT_PATH ./build) #配置输出目录 set(JAVA_HOME $ENV{JAVA_HOME}) #获取系统环境变量中的JAVA_HOME并设置到JAVA_HOME 变量中 include_directories( #引入的头文件位置 include ${JAVA_HOME}/include ${JAVA_HOME}/include/dawin ) add_library(native SHARED ${SRC}) #生成动态库
二、
#cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=C:/mingw64/bin/make.exe cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
标签:set,cmake,sample,HOME,JNI,DCMAKE,JAVA,COMPILER From: https://www.cnblogs.com/luoxh-whn/p/18394163