title: Building OpenCV as static libraries
body: <p>Maybe I'm missing something but I'm not able to build the static libraries of opencv.</p>
  
  <p>Setup: </p>
  
  <p>Kubuntu 12.04</p>
  
  <p>gcc 4.6.3</p>
  
  <p>make 3.81</p>
  
  <p>cmake 2.8.7</p>
  
  <p>opencv 2.4.6.1 (last available on site)</p>
  
  <p>I do all the job manually. I tried with cmake-gui with no more success.</p>
  
  <p>I do what it is written.</p>
  
  <p>$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D WITH_QT=ON -D BUILD_SHARED_LIBRARIES=OFF ..</p>
  
  <p>(I also tried with BUILD_SHARED_LIBRARIES=NO)</p>
  
  <p>What I get is (for core for example):</p>
  
  <ul>
  <li>libopencv_core.so</li>
  <li>libopencv_core.so.2.4</li>
  <li>libopencv_core.so.2.4.6</li>
  <li><strong>libopencv_core_pch_dephelp.a</strong></li>
  </ul>
  
  <p>To say the truth, I expected <strong>libopencv_core.a</strong>.</p>
  
  <p>I'm a newbie with package/libs building on Linux. I'm sure there is something I did wrong but I don't know what. Also I don't want to use dynamic libraries...</p>
  
  <p>Thanks for your help!</p>
  
  <p><strong>EDIT</strong> Removed the blank space between -D ... in cmake command line</p>
  
  <pre><code>Result:
  
  -- General configuration for OpenCV 2.4.6.1 =====================================
  --   Version control:               unknown
  -- 
  --   Platform:
  --     Host:                        Linux 3.2.0-51-generic x86_64
  --     CMake:                       2.8.7
  --     CMake generator:             Unix Makefiles
  --     CMake build tool:            /usr/bin/make
  --     Configuration:               RELEASE
  -- 
  --   C/C++:
  --     Built as dynamic libs?:      YES
  --     C++ Compiler:                /usr/bin/c++  (ver 4.6)
  --     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
  --     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG -ggdb3
  --     C Compiler:                  /usr/bin/gcc
  --     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
  --     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG -ggdb3
  --     Linker flags (Release):      
  --     Linker flags (Debug):        
  --     Precompiled headers:         YES
  -- 
  --   OpenCV modules:
  --     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib photo legacy gpu nonfree java python stitching superres ts videostab
  </code></pre>
  
  <p>...</p>
  
  <pre><code>-- Configuring done
  -- Generating done
  CMake Warning:
    Manually-specified variables were not used by the project:
  
      BUILD_PYTHON_SUPPORT
      BUILD_SHARED_LIBRARIES
  </code></pre>
  
  <p>I still see <strong>Built as dynamic libs?:      YES</strong> and it tells me that it doesn't care about the <strong>BUILD_SHARED_LIBRARIES</strong> variable!</p>