Add better error message when an in-source build is attempted. Add workaround for...
authorhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 16 Dec 2013 20:41:56 +0000 (20:41 +0000)
committerhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 16 Dec 2013 20:41:56 +0000 (20:41 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1345 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/CMakeLists.txt
fdmdv2/CMakeLists.txt
fdmdv2/cmake/BuildWxWidgets.cmake

index a8ad36656a7f553ac2881a3d498b88e974fece0b..e9ef22623eabb4306d01cd02591bc3aaf2ac4b0a 100644 (file)
@@ -15,6 +15,11 @@ cmake_minimum_required(VERSION 2.8)
 #
 set(CMAKE_DISABLE_SOURCE_CHANGES ON)
 set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+  message(FATAL_ERROR "In-source builds in ${CMAKE_BINARY_DIR} are not "
+   "allowed, please remove ./CMakeCache.txt and ./CMakeFiles/, create a "
+   "separate build directory and run cmake from there.")
+endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
 
 project(codec2)
 
index f879470ea29672adde516c04c08d71944c1e54e2..3a0031d621f6046b4f4f087630c23ed2f2218e06 100644 (file)
@@ -13,9 +13,11 @@ cmake_minimum_required(VERSION 2.8)
 # files manually.
 set(CMAKE_DISABLE_SOURCE_CHANGES ON)
 set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
-if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
-   message(FATAL_ERROR "In-source builds are not allowed.")
-endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+  message(FATAL_ERROR "In-source builds in ${CMAKE_BINARY_DIR} are not "   
+   "allowed, please remove ./CMakeCache.txt and ./CMakeFiles/, create a "
+   "separate build directory and run cmake from there.")
+endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
 
 project(FreeDV)
 
@@ -68,14 +70,6 @@ set(USE_STATIC_CODEC2 FALSE CACHE BOOL
     "Download and build static codec2 instead of the system library.")
 set(BOOTSTRAP_WXWIDGETS FALSE CACHE BOOL
     "Download and build static wxWidgets instead of the system library.")
-# If we're bootstrapping wxWidgets then this must be set true.
-if(BOOTSTRAP_WXWIDGETS)
-    set(USE_STATIC_WXWIDGETS TRUE CACHE BOOL
-    "Perform bootstrap build of wxWidgets, see README.cmake for more details.")
-else(BOOTSTRAP_WXWIDGETS)
-    set(USE_STATIC_WXWIDGETS FALSE CACHE BOOL
-    "Perform bootstrap build of wxWidgets, see README.cmake for more details.")
-endif(BOOTSTRAP_WXWIDGETS)
 
 if(USE_STATIC_DEPS)
     set(USE_STATIC_PORTAUDIO TRUE FORCE)
@@ -90,19 +84,20 @@ endif(USE_STATIC_DEPS)
 # Pull in external wxWidgets target if performing static build.
 #
 if(BOOTSTRAP_WXWIDGETS)
+    message(STATUS "Adding wxWidgets build target...")
     include(cmake/BuildWxWidgets.cmake)
 endif(BOOTSTRAP_WXWIDGETS)
 
 #
 # Perform bootstrap build of wxWidgets
 #
-if(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)
+if(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG})
     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)
+else(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG})
 
 # Setup empty list to append to.
 set(FREEDV_LINK_LIBS "")
@@ -336,14 +331,15 @@ endif(NOT USE_STATIC_SOX)
 #
 # Find wxWidgets
 #
-set(WXCONFIG "" CACHE FILEPATH "Location of wx-config binary.")
-set(WXRC "" CACHE FILEPATH "Location of wxrc binary.")
-if(USE_STATIC_WXWIDGETS)
-    set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config")
-    set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc")
-    #set(wxWidgets_CONFIG_OPTIONS --linkdeps)
-    list(APPEND FREEDV_STATIC_DEPS wxWidgets)
-endif(USE_STATIC_WXWIDGETS)
+if(NOT BOOTSTRAP_WXWIDGETS)
+    set(WXCONFIG "" CACHE FILEPATH "Location of wx-config binary.")
+    set(WXRC "" CACHE FILEPATH "Location of wxrc binary.")
+endif(NOT BOOTSTRAP_WXWIDGETS)
+#if(BOOTSTRAP_WXWIDGETS)
+#    set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config")
+#    set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc")
+#    list(APPEND FREEDV_STATIC_DEPS wxWidgets)
+#endif(BOOTSTRAP_WXWIDGETS)
 message(STATUS "Looking for wxWidgets...")
 if(WXCONFIG)
     message(STATUS "wx-config: ${WXCONFIG}")
@@ -353,7 +349,7 @@ if(WXRC)
     message(STATUS "wxrc: ${WXRC}")
     set(wxWidgets_wxrc_EXECUTABLE ${WXRC})
 endif(WXRC)
-set(WX_VERSION_MIN 2.9.0)
+set(WX_VERSION_MIN 3.0.0)
 find_package(wxWidgets REQUIRED core base aui html net adv)
 execute_process(COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --version
     OUTPUT_VARIABLE WX_VERSION)
@@ -474,4 +470,4 @@ if(WIN32)
     include(CPack)
 endif(WIN32)
 
-endif(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets)
+endif(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG})
index 74c34cc11f99fe14ddd056ab4aba443a586ac86c..1a1c4104c3b672aef04f35613153867610a8fc7c 100644 (file)
@@ -1,4 +1,4 @@
-set(WXWIDGETS_TARBALL "wxWidgets-2.9.4")
+set(WXWIDGETS_TARBALL "wxWidgets-3.0.0")
 
 include(ExternalProject)
 ExternalProject_Add(wxWidgets
@@ -9,7 +9,9 @@ ExternalProject_Add(wxWidgets
     BUILD_COMMAND $(MAKE)
     INSTALL_COMMAND $(MAKE) install
 )
-set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config")
-set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc")
+
+ExternalProject_Get_Property(wxWidgets install_dir)
+set(WXCONFIG "${install_dir}/bin/wx-config")
+set(WXRC "${install_dir}/bin/wxrc")
 #list(APPEND FREEDV_LINK_LIBS ${wxWidgets_LIBRARIES})
 #list(APPEND FREEDV_STATIC_DEPS wxWidgets)