You can have as many add_executable as you want.

Typically what you see is the project either just includes expat and builds it or offers the user the option of using a pre-built from the system (or some other location).

OPTION(USE_SYSTEM_EXPAT "Use an expat library supplied on the system" OFF)
IF (USE_SYSTEM_EXPAT)
 FindPackage(EXPAT)
 # Make sure expat was found
  if(NOT EXPAT_FOUND)
     message(FATAL_ERROR "Expat was NOT found and is needed")
  endif()
else(USE_SYSTEM_EXPAT)
  add_subdirectory(${My_Expat_Directory} ${PROJECT_BINARY_DIR}/Expat)
endif(USE_SYSTEM_EXPAT)

The above should get you started.

_________________________________________________________
Mike Jackson                  mike.jack...@bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Jul 22, 2009, at 12:06 PM, ML wrote:

Hi All,

So my learning is going ok so far.

My question right now is how might I check for the existence of a previously build library. If it exists do nothing, if it does not exist build it.

My Example:
1. if libexpat.a exists in bin/ do nothing
2. if libexpat.a does not exist, my main project needs it, so build it.

Can I have a target called 'expat' and variable for the expat source files, etc and another add_executable?

Does anyone have a template?

Best,

-Jason

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to