参考博客

http://www.cnblogs.com/skyfsm/p/6840202.html

针对 模块计算机类型“X64”与目标计算机类型“X86”这个问题,我使用cmake 对环境的工程进行设置;主要是

..\..\cmake311\bin\cmake.exe -D WIN32=1 -G "Visual Studio 14 Win64" 通过Win64配置环境为x64。

CMakeLists.txt文件:

Project(lesson1)
cmake_minimum_required(VERSION 3.11.0)

set(opencv_include_dir  C:/opencv/build/include
                        C:/opencv/build/include/opencv 
                        C:/opencv/build/include/opencv2
                        )
                        
set(opencv_lib_dir  C:/opencv/build/x64/vc14/lib)
if(WIN32)
    add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif(WIN32)
set(source_files main.cpp 
                 )
include_directories(./
                    ${opencv_include_dir})
link_directories(${opencv_lib_dir})
add_executable(lesson1 ${source_files})
target_link_libraries(lesson1 opencv_world310d.lib)

 

envconfig.bat文件

cd /d "%~dp0"
mkdir build
mkdir install
cd build
..\..\cmake311\bin\cmake.exe -D WIN32=1 -G "Visual Studio 14 Win64" --build ..\
cd ..
pause

目录结构:

opencv/cmkae311

opencv/lesson1

opencv/lesson1/CMakeLists.txt

opencv/lesson1/envconfig.bat

opencv/lesson1/main.cpp

 

        

posted on 2018-06-12 18:25  卡贝天师  阅读(128)  评论(0编辑  收藏  举报