Hi all,<div><br></div><div>I have been trying to build a project under MSVC which I generated through CMAKE. The same projects compiles correctly without any error in UBUNTU. But</div><div>when I build the same project under msvc, I get so many linking errors. From the project configuration of msvc project I figured it out that none of libraries are linked.</div>
<div>The project configuration does not contain linker tab, but rather a Librarian tab comes which does not contain any of the linked libraries which I put in TARGET_LINK_LIBRARIES.</div><div><br></div><div>I am relatively new to cmake. Please point out where I am making mistake.</div>
<div><br></div><div>I would put here the root CMakeLists.txt and one subdirectory ./lib/imagelib CMakeLists.txt</div><div><br></div><div>cmake_minimum_required(VERSION 2.4)</div><div><br></div><div><br></div><div>if(UNIX)</div>
<div>PROJECT(hybridnccsurfacecoloring C CXX Fortran)</div><div>endif(UNIX)</div><div><br></div><div>if(WIN32)</div><div>PROJECT(hybridnccsurfacecoloring C CXX)</div><div>endif(WIN32)</div><div><br></div><div><br></div><div>
ADD_DEFINITIONS(-DNO_BLAS_WRAP)</div><div><br></div><div><br></div><div>SET(OpenCV_DIR "E:/opencv-devel/opencv/release2")</div><div>#SET(BOOST_ROOT "C:/Program Files/boost/boost_1_45_0")</div><div>#set (Boost_DEBUG ON)</div>
<div><br></div><div>find_package(OpenCV)</div><div>find_package(ImageMagick COMPONENTS Magick++ MagickCore)</div><div>#find_package(Boost 1.45.0 COMPONENTS filesystem)</div><div><br></div><div><br></div><div>if(OpenCV_FOUND) </div>
<div>message(STATUS "Opencv found.")</div><div>include_directories(${OpenCV_INCLUDE_DIRS})</div><div>link_libraries(${OpenCV_LIBS})</div><div>ENDIF(OpenCV_FOUND)</div><div><br></div><div>if(ImageMagick_FOUND) </div>
<div>message(STATUS "Image Magick found.")</div><div>include_directories(${ImageMagick_INCLUDE_DIRS})</div><div>link_libraries(${ImageMagick_LIBRARIES})</div><div>ENDIF(ImageMagick_FOUND)</div><div><br></div><div>
include_directories( "${CMAKE_SOURCE_DIR}/src"</div><div> "${CMAKE_SOURCE_DIR}/include"</div><div> "${CMAKE_SOURCE_DIR}/lib/imagelib"</div><div> "${CMAKE_SOURCE_DIR}/lib/matrix"</div>
<div> "${CMAKE_SOURCE_DIR}/lib/5point"</div><div> "${CMAKE_SOURCE_DIR}/lib/epnp"</div><div> "${CMAKE_SOURCE_DIR}/lib/mathlib"</div>
<div> "${CMAKE_SOURCE_DIR}/lib/sba"</div><div> "${CMAKE_SOURCE_DIR}/lib/Jhead"</div><div> "${CMAKE_SOURCE_DIR}/lib/bundlesrc"</div>
<div> "${CMAKE_SOURCE_DIR}/lib/sfm"</div><div> "${CMAKE_SOURCE_DIR}/lib/Descriptors"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> </div>
<div> <span class="Apple-tab-span" style="white-space:pre">                </span> "C:/downloads/ImageMagick-6.6.2"</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> "C:/Program Files/boost/boost_1_45_0"</div>
<div> )</div><div><br></div><div>if(WIN32)</div><div>include_directories(</div><div> "${CMAKE_SOURCE_DIR}/lib/f2c"</div><div> "${CMAKE_SOURCE_DIR}/lib/getopt"</div><div> "${CMAKE_SOURCE_DIR}/lib/jpeg"</div>
<div> "${CMAKE_SOURCE_DIR}/lib/zlib"</div><div> "${CMAKE_SOURCE_DIR}/lib/ann/include"</div><div>)</div><div><br></div><div>endif(WIN32)</div><div><br></div><div><br></div><div>link_libraries( </div>
<div><br></div><div> <span class="Apple-tab-span" style="white-space:pre">        </span> "C:/downloads/ImageMagick-6.6.2/VisualMagick/lib/IM_MOD_DB_magick_.lib"</div><div> "C:/downloads/ImageMagick-6.6.2/VisualMagick/lib/CORE_DB_magick_.lib"</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span> "C:/Program Files/boost/boost_1_45_0/stage/lib/libboost_filesystem-vc90-mt-gd-1_45.lib"</div><div> )</div><div>
<br></div><div><br></div><div><br></div><div>add_executable( hybridnccsurfacecoloring src/plyfilewriter.cpp</div><div> src/bundler_preprocesser.cpp</div><div> src/image_property_extractor.cpp</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> src/BundleOutputReader.cpp main.cpp)</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> </div>
<div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>TARGET_LINK_LIBRARIES(hybridnccsurfacecoloring bundler imagelib matrix mathlib </div><div> 5point libsba libepnp </div>
<div> sfm libDescriptors f2c minpack lapack ann)</div><div><br></div><div>if(WIN32)</div><div>TARGET_LINK_LIBRARIES(hybridnccsurfacecoloring getopt jpeg)</div><div>endif(WIN32)</div><div><br></div><div>
<br></div><div><br></div><div>add_subdirectory(lib) </div><div><br></div><div><br></div><div><br></div><div>###################################################</div><div><br></div><div>One CMakeLists.txt under ./lib/imagelib</div>
<div><br></div><div><div>include_directories(</div><div> "."</div><div> "../../include"</div><div> "../imagelib"</div><div>)</div><div><br></div><div><br></div><div>add_library(matrix ./matrix.c svd svd.c vector vector.c)</div>
<div>TARGET_LINK_LIBRARIES(matrix lapack f2c minpack blas)</div></div><div><br></div><div><br></div><div><br></div><div>There are few more libraries under lib folder , some are dependent on others. I have written similar codes for them as above.</div>
<div>They work fine under LINUX but they are giving linker error under windows msvc.</div><div><br></div><div>I would greatly appreciate any help here. </div><div><br></div><div><br></div><div>Thanks</div><div>Avanindra</div>