我想指定一个相对于CMake中当前目录的路径,但是找不到解决方案.
我的项目在于:
C:/Projects/ProjectA/CMakeLists.txt
Run Code Online (Sandbox Code Playgroud)
我想使用set()命令指定以下目录的相对路径的名称
C:/External/Library
Run Code Online (Sandbox Code Playgroud)
换句话说,什么是CMake翻译
../../External/Library?
Run Code Online (Sandbox Code Playgroud)
谢谢,
我目前正在尝试将我的OpenGL应用程序移植到Android,并且我仍然坚持如何正确导入和构建GLM http://glm.g-truc.net/.我在标准C++应用程序中使用GLM没有问题,但我对NDK很新.我已尝试在网上发布的所有其他解决方案,但没有运气.这是我到目前为止:
我使用的是最新版本的GLM(0.9.4)
我的.cpp文件包含:
#include <glm\glm.hpp>
Run Code Online (Sandbox Code Playgroud)
我的Android.mk文件如下所示:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libgl2jni
LOCAL_CFLAGS := -Werror
LOCAL_SRC_FILES := gl_code.cpp
LOCAL_LDLIBS := -llog -lGLESv2
APP_STL := gnustl_static
LOCAL_C_INCLUDES += \Development\OpenGL\glm-0.9.4.0\
include $(BUILD_SHARED_LIBRARY)
Run Code Online (Sandbox Code Playgroud)
**\Development\OpenGL\glm-0.4.0**是我的C盘上GLM文件的位置
在构建时,我收到此错误:
In file included from jni/gl_code.cpp:28:0,
\Development\OpenGL\glm-0.94.0\glm\glm.hpp:86:18: fatal error: limits: No such file or directory
Run Code Online (Sandbox Code Playgroud)
这类似于codemonkey的问题https://gamedev.stackexchange.com/questions/47128/android-ndk-build-cant-find-glm-headers其中"APP_STL:= gnustl_static"建议.
看来我的源文件设置正确,但是有一些我无法识别的编译器问题.任何帮助是极大的赞赏!
这是一个非常微不足道的问题,可能是由于我对 CMake 缺乏经验。我已按照http://fabzter.com/blog/cmake-tutorial-1上的教程进行操作,但遇到链接问题。
基本上我有一个 MathFuncs 库和一个使用 MathFuncs 的可执行文件。MathFuncs 的 CMakeList 是:
cmake_minimum_required(VERSION 2.8)
project(MathFuncs)
include_directories(${PROJECT_SOURCE_DIR})
SET (HEADER_FILES mysqrt.hpp)
add_library(MathFuncs SHARED mysqrt.cpp ${HEADER_FILES})
Run Code Online (Sandbox Code Playgroud)
可执行的 CMakeLists 是:
cmake_minimum_required (VERSION 2.6)
project (Tutorial)
set (Tutorial_VERSION_MAJOR 1)
set (Tutorial_VERSION_MINOR 0)
set (Tutorial_VERSION_BUGFIX 0)
#configure header file to pass some of the CMake settings
#to the source code
configure_file(
"${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
"${PROJECT_BINARY_DIR}/TutorialConfig.h"
)
# add the binary tree to the search path for include files
# so that we will find TutorialConfig.h
include_directories("${PROJECT_BINARY_DIR}")
# …Run Code Online (Sandbox Code Playgroud)