title: Linking to Armadillo libraries with CMake
body: <p>I am trying to install MLPack on windows 8.
  I configure the CMakeLists.txt file with:</p>
  
  <pre><code>set(ARMADILLO_LIBRARY "C:\\Program Files (x86)\\armadillo\\lib")
  set(ARMADILLO_INCLUDE_DIR "C:\\Program Files (x86)\\armadillo\\include")
  </code></pre>
  
  <p>Then when I ran CMake I had a whole series of warning like these ones:</p>
  
  <pre><code>WARNING: Target "mlpack" requests linking to directory "C:\Program Files (x86)\armadillo\lib".  Targets may link only to libraries.  CMake is dropping the item.
  </code></pre>
  
  <p>In \mlpack-1.0.4\src\mlpack directory I found another CMakeLists file with:</p>
  
  <pre><code>target_link_libraries(mlpack
    ${ARMADILLO_LIBRARIES}
    ${Boost_LIBRARIES}
    ${LIBXML2_LIBRARIES}
  )
  </code></pre>
  
  <p>that I changed to (not sure if that was a good idea):</p>
  
  <pre><code>target_link_libraries(mlpack
    ${Boost_LIBRARIES}
  )
  link_directories(mlpack
    ${ARMADILLO_LIBRARIES}
    ${LIBXML2_LIBRARIES}
  )
  </code></pre>
  
  <p>then CMake seems to be running smoothly:</p>
  
  <pre><code>-- Found Armadillo: C:\Program Files (x86)\armadillo\lib (found suitable version "3.800.2", minimum required is "2.4.2")
  -- Found LibXml2: C:\cpp\libraries\libxml2-2.7.8.win32\lib (found suitable version "2.7.8", minimum required is "2.6.0")
  -- Boost version: 1.53.0
  -- Found the following Boost libraries:
  --   program_options
  --   unit_test_framework
  -- Boost version: 1.53.0
  -- Found the following Boost libraries:
  --   random
  -- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE)
  -- Configuring done
  -- Generating done
  -- Build files have been written to: C:/cpp/libraries/mlpack-1.0.4
  </code></pre>
  
  <p>but now when running make I have tons of such errors :</p>
  
  <pre><code>Linking CXX executable ..\..\..\..\gmm.exe
  CMakeFiles\gmm.dir/objects.a(gmm_main.cpp.obj):gmm_main.cpp:(.text+0xb9): undefined reference to `wrapper_dgemv_'
  CMakeFiles\gmm.dir/objects.a(gmm_main.cpp.obj):gmm_main.cpp:(.text$_ZN4arma6auxlib10det_lapackIdEET_RKNS_3MatIS2_EEb[__ZN4arma6auxlib10det_lapackIdEET_RKNS_3MatIS2_EEb]+0x115): undefined reference to `wrapper_dgetrf_'
  </code></pre>
  
  <p>which after investigation seems to be related to Armadillo.</p>
  
  <p>Any idea what is happening ? I guess I should use target_link_libraries for Armadillo but I am not sure how.</p>