On 12/12/13 2:13 PM, "Richard Shaw" 
<[email protected]<mailto:[email protected]>> wrote:

Very interesting but not quite what I'm looking for, in this case the main 
CMakeLists.txt does actually build a project, I just need it to build wxWidgets 
first.

Well it's up to you but 'build X and then build Y' is the definition of how 
using ExternalProject work.

What you describe doesn't seem like it would ever work, because the CMake 
source code is evaluated at Configuration time, not compile time.  How is 
wxWidgets a target? Do you have an ADD_CUSTOM_TARGET command somewhere? You 
might have had it accidentally work because of how variables persist between 
make/configure runs in CMakeCache.txt, but I don't see how it could ever be 
dependable or predictable.

if(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)
message("Build wxWidgets")
else()
message("Doing normal build")
endif()

The CMake code below would do what you want to do. It builds wxWindows, and 
then builds your project.

project(TWOSTAGE)
include(ExternalProject)
if(NOT BUILD_MY_PROJECT) # starts out un-set/false at top level build dir
  include(cmake/BuildWxWidgets.cmake)
  # your project builds in a subdirectory of the top level build dir
  ExternalProject_add(MyActualProject
DOWNLOAD_COMMAND ""
        SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
        BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/MyActualProject-build
        CMAKE_ARGS
-DBUILD_MY_PROJECT:BOOL=TRUE
        <all relevant cmake args, including where to find wxWindows 
libs/include>
        INSTALL_COMMAND "" # presumably you don't want to install immediately.
  )
else()
  <normal build stuff, depending on WxWidgets>
endif()



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the 
Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and 
may be legally privileged.  If you are not the intended recipient, you are 
hereby notified that any retention, dissemination, distribution, or copying of 
this communication is strictly prohibited.  Please reply to the sender that you 
have received the message in error, then delete it.  Thank you.
________________________________
--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

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

Reply via email to