title: Is there are rule in CMake that causes properties set in toolchain file to not persistent to CMakeLists?
body: <p>I am trying to build OpenAL with the Android NDK. The license requires that the library be dynamically loaded. I receive the following message when attempting to build:</p>
  
  <pre><code>CMake Warning (dev) at CMakeLists.txt:1032 (ADD_LIBRARY):
    ADD_LIBRARY called with SHARED option but the target platform does not
    support dynamic linking.  Building a STATIC library instead.  This may lead
    to problems.
  </code></pre>
  
  <p>My toolchain file includes <code>SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS true)</code> and looks like this:</p>
  
  <pre><code>SET(CMAKE_SYSTEM_NAME Generic)
  SET(CMAKE_C_COMPILER "${HOST}-gcc")
  SET(CMAKE_CXX_COMPILER "${HOST}-g++")
  
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  
  set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
  set(ENV{PKG_CONFIG_PATH} "")
  
  SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS true)
  </code></pre>
  
  <p>I create a <code>build</code> directory in the source and invoke cmake with the following:</p>
  
  <pre><code>cmake .. -DALSOFT_BACKEND_WAVE=0 -DALSOFT_REQUIRE_OPENSL=1 -DALSOFT_NO_CONFIG_UTIL=1 -DALSOFT_EXAMPLES=0 -DALSOFT_UTILS=0 -DALSOFT_CONFIG=0 -DCMAKE_INSTALL_PREFIX=$ANDROID_DEV/opt -DCMAKE_INSTALL_RPATH=$ANDROID_DEV/opt -DHOST= -DCMAKE_TOOLCHAIN_FILE=../../android-toolchain.cmake
  </code></pre>
  
  <p>I have verified that the toolchain file is loaded by adding garbage to it and seeing the cmake command result in an error.</p>
  
  <p>The <code>CMakeLists.txt</code> file starts like this:</p>
  
  <pre><code># CMake build file list for OpenAL
  
  CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  
  PROJECT(OpenAL)
  
  IF(COMMAND CMAKE_POLICY)
    CMAKE_POLICY(SET CMP0003 NEW)
    CMAKE_POLICY(SET CMP0005 NEW)
  ENDIF(COMMAND CMAKE_POLICY)
  
  SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
  </code></pre>
  
  <p>I have successfully built the library as a dynamic module by placing <code>SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS true)</code> in <code>CMakeList.txt</code> immediately after the <code>PROJECT(OpenAL)</code>. If I place it before this the build results in a static library with the previously mentioned warning.</p>
  
  <p>It seems as though the property <code>TARGET_SUPPORTS_SHARED_LIBS</code> is being reset after <code>PROJECT(OpenAL)</code>. I have read the documetnation for <code>PROJECT</code>, <code>TARGET_SUPPORTS_SHARED_LIBS</code> and including a toolchain file but have not found anything that explicitly mentions resetting of target toolchain variables.</p>
  
  <p>Does CMake have some rules that causes this variable to be reset between the toolchain file and the CMakeLists.txt processing, or perhaps before and after the <code>PROJECT</code> command?</p>
  
  <p>I am using CMake 2.8.12.2. Each time I issue the CMake command, I do so with a fresh copy of the source directory to be sure that there isn't a caching issue.</p>