Re: [CMake] Testing for a target broke for me

2013-12-20 Thread Richard Shaw
Ok, I didn't notice my replies going to Norman only, apologies.

Answer from upstream is that it returns true if the target exists, it does
not care from a ExternalProject POV that the target has been built. The
documentation has been clarified.

I have it working properly now testing for the existence of wx-config which
will only exist if it's been built.

Thanks,
Richard
--

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

Re: [CMake] Testing for a target broke for me

2013-12-12 Thread Williams, Norman K
On 12/12/13 2:13 PM, "Richard Shaw" 
mailto:hobbes1...@gmail.com>> 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

INSTALL_COMMAND "" # presumably you don't want to install immediately.
  )
else()
  
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

Re: [CMake] Testing for a target broke for me

2013-12-12 Thread Richard Shaw
On Thu, Dec 12, 2013 at 11:20 AM, Williams, Norman K <
norman-k-willi...@uiowa.edu> wrote:

> This is a case for ExternalProjects.
> http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html


I've read that before but didn't find anything new there. I also tried
checking the state of BOOTSTRAP_WXWIDGETS and the target separately and
both individually seem to test correctly.

It seems the problem is:
if(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)

though I don't see anything semantically wrong with it.


Also search for 'cmake superbuild' for discussion of how people are using
> external projects.
>
> An example build setup for prerequisites/projects here:
> https://github.com/BRAINSia/NamicExternalProjects
>

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.

Thanks,
Richard
--

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

Re: [CMake] Testing for a target broke for me

2013-12-12 Thread Williams, Norman K
This is a case for ExternalProjects.
http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html

Also search for 'cmake superbuild' for discussion of how people are using
external projects.

An example build setup for prerequisites/projects here:
https://github.com/BRAINSia/NamicExternalProjects



--
Kent Williams norman-k-willi...@uiowa.edu






On 12/12/13 10:31 AM, "Richard Shaw"  wrote:

>I've had this working and I don't *THINK* I changed anything that would
>cause it to fail now but I'm not completely sure.
>
>
>I have a project I converted over to cmake from automake which requires
>wxWidgets 3.0 (or the 2.9 devel branch). Although it just released I
>still want to maintain the ability to build it within the project itself
>for distro's that are slow to adopt it
> (on linux) or windows/mac as well.
>
>
>Because wxWidgets uses a custom script to get compiler flags and includes
>I have to "bootstrap" the build such that the first time you run
>cmake/make it builds wxWidgets and the second time it builds the project.
>To that end I had the follow strategy working:
>
>
>#
># Pull in external wxWidgets target if performing static build.
>#
>if(BOOTSTRAP_WXWIDGETS)
>include(cmake/BuildWxWidgets.cmake)
>endif(BOOTSTRAP_WXWIDGETS)
>
>
>#
># Perform bootstrap build of wxWidgets
>#
>if(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)
>message(STATUS "Will perform bootstrap build of wxWidgets.
>   After make step completes, re-run cmake and make again to perform
>FreeDV build.")
>#
># Continue normal build if not bootstrapping wxWidgets or already built
>it.
>#
>else(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)
>
>
>
>
>
>
>endif(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)
>
>---
>
>
>Even though I can verify that BOOTSTRAP_WXWIDGETS is true, it's failing
>the conditional and I can only assume it has to do with the target
>checking.
>
>
>Any ideas?
>
>
>Thanks,
>Richard
>




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


[CMake] Testing for a target broke for me

2013-12-12 Thread Richard Shaw
I've had this working and I don't *THINK* I changed anything that would
cause it to fail now but I'm not completely sure.

I have a project I converted over to cmake from automake which requires
wxWidgets 3.0 (or the 2.9 devel branch). Although it just released I still
want to maintain the ability to build it within the project itself for
distro's that are slow to adopt it (on linux) or windows/mac as well.

Because wxWidgets uses a custom script to get compiler flags and includes I
have to "bootstrap" the build such that the first time you run cmake/make
it builds wxWidgets and the second time it builds the project. To that end
I had the follow strategy working:

#
# Pull in external wxWidgets target if performing static build.
#
if(BOOTSTRAP_WXWIDGETS)
include(cmake/BuildWxWidgets.cmake)
endif(BOOTSTRAP_WXWIDGETS)

#
# Perform bootstrap build of wxWidgets
#
if(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)
message(STATUS "Will perform bootstrap build of wxWidgets.
   After make step completes, re-run cmake and make again to perform FreeDV
build.")
#
# Continue normal build if not bootstrapping wxWidgets or already built it.
#
else(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)



endif(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)
---

Even though I can verify that BOOTSTRAP_WXWIDGETS is true, it's failing the
conditional and I can only assume it has to do with the target checking.

Any ideas?

Thanks,
Richard
--

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