Revision: 75587
          http://sourceforge.net/p/brlcad/code/75587
Author:   starseeker
Date:     2020-04-23 20:57:46 +0000 (Thu, 23 Apr 2020)
Log Message:
-----------
Interesting.  On modern Ubuntu, the packages do install the headers necessary 
to build itcl/itk3 but they do it in a subdirectory.  Don't know yet if this is 
a new standard practice for Tcl/Tk 8.6 packaging, but would be nice if it is - 
set up the logic to check.  This actually lets us build our Tcl/Tk packages 
against a system install with the src/other/tcl and src/other/tk directories 
being completely removed when those headers are present, and should also be a 
better bet for compiling compatibly with the system libs (our local copy may 
not match the system version - there's certainly no guarantee.)

Modified Paths:
--------------
    brlcad/trunk/src/other/itcl3/CMakeLists.txt
    brlcad/trunk/src/other/itk3/CMakeLists.txt

Modified: brlcad/trunk/src/other/itcl3/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/other/itcl3/CMakeLists.txt 2020-04-23 20:35:09 UTC (rev 
75586)
+++ brlcad/trunk/src/other/itcl3/CMakeLists.txt 2020-04-23 20:57:46 UTC (rev 
75587)
@@ -172,23 +172,32 @@
 set(ITCL_INCLUDE_PATH ${ITCL_SOURCE_DIR}/generic ${ITCL_BINARY_DIR}/include)
 mark_as_advanced(ITCL_INCLUDE_PATH)
 
+
+# ITcl requires private Tcl headers, which we can't assume from a system
+# install of Tcl.  The workaround is to use our local copies and hope they
+# are workable. (Ugh.)
+if (TARGET tcl OR NOT EXISTS ${TCL_INCLUDE_PATH}/tcl-private/generic)
+    set(TCL_PRIVATE_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/../tcl/generic)
+  if(NOT WIN32)
+    set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} 
${CMAKE_CURRENT_SOURCE_DIR}/../tcl/unix)
+  else(NOT WIN32)
+    set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} 
${CMAKE_CURRENT_SOURCE_DIR}/../tcl/win)
+  endif(NOT WIN32)
+else()
+  set(TCL_PRIVATE_HDRS ${TCL_INCLUDE_PATH}/tcl-private/generic)
+  if(NOT WIN32)
+    set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} 
${TCL_INCLUDE_PATH}/tcl-private/unix)
+  else(NOT WIN32)
+    set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} 
${TCL_INCLUDE_PATH}/tcl-private/win)
+  endif(NOT WIN32)
+endif ()
+
 include_directories(
   ${TCL_INCLUDE_PATH}
   ${ITCL_INCLUDE_PATH}
-  ${CMAKE_BINARY_DIR}/include
-  ${CMAKE_SOURCE_DIR}/include
+  ${TCL_PRIVATE_HDRS}
   )
 
-# ITcl requires private Tcl headers, which we can't assume from a system
-# install of Tcl.  The workaround is to use our local copies and hope they
-# are workable. (Ugh.)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../tcl/generic)
-if(NOT WIN32)
-  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../tcl/unix)
-else(NOT WIN32)
-  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../tcl/win)
-endif(NOT WIN32)
-
 add_library(itcl ${ITCL_SRCS})
 target_link_libraries(itcl ${M_LIBRARY} ${TCL_STUB_LIBRARY} )
 set_target_properties(itcl PROPERTIES VERSION ${ITCL_VERSION} SOVERSION 
${ITCL_VERSION_MAJOR})

Modified: brlcad/trunk/src/other/itk3/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/other/itk3/CMakeLists.txt  2020-04-23 20:35:09 UTC (rev 
75586)
+++ brlcad/trunk/src/other/itk3/CMakeLists.txt  2020-04-23 20:57:46 UTC (rev 
75587)
@@ -42,9 +42,9 @@
 # set CMake project name
 project(ITK)
 
-if(NOT TK_LIBRARY OR NOT TK_INCLUDE_PATH)
-  find_package(TK)
-endif(NOT TK_LIBRARY OR NOT TK_INCLUDE_PATH)
+if(NOT TCL_LIBRARY OR NOT TCL_INCLUDE_PATH OR NOT TK_LIBRARY)
+  find_package(TCL)
+endif(NOT TCL_LIBRARY OR NOT TCL_INCLUDE_PATH OR NOT TK_LIBRARY)
 
 if(NOT TCL_STUB_LIBRARY OR NOT TK_STUB_LIBRARY OR NOT ITCL_STUB_LIBRARY)
   if(TARGET tclsh)
@@ -177,6 +177,25 @@
 set(ITK_INCLUDE_DIRS ${ITK_SOURCE_DIR}/generic ${ITK_BINARY_DIR}/include)
 mark_as_advanced(ITK_INCLUDE_DIRS)
 
+# Like ITcl, Itk requires private Tcl headers, which we can't assume from a 
system
+# install of Tcl.  The workaround is to use our local copies and hope they
+# are workable. (Ugh.)
+if (TARGET tk OR NOT EXISTS ${TCL_INCLUDE_PATH}/tcl-private/generic)
+    set(TCL_PRIVATE_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/../tcl/generic)
+  if(NOT WIN32)
+    set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} 
${CMAKE_CURRENT_SOURCE_DIR}/../tcl/unix)
+  else(NOT WIN32)
+    set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} 
${CMAKE_CURRENT_SOURCE_DIR}/../tcl/win)
+  endif(NOT WIN32)
+else()
+  set(TCL_PRIVATE_HDRS ${TCL_INCLUDE_PATH}/tcl-private/generic)
+  if(NOT WIN32)
+    set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} 
${TCL_INCLUDE_PATH}/tcl-private/unix)
+  else(NOT WIN32)
+    set(TCL_PRIVATE_HDRS ${TCL_PRIVATE_HDRS} 
${TCL_INCLUDE_PATH}/tcl-private/win)
+  endif(NOT WIN32)
+endif ()
+
 include_directories(
   ${TCL_INCLUDE_PATH}
   ${TK_INCLUDE_PATH}
@@ -183,20 +202,11 @@
   ${ITCL_INCLUDE_PATH}
   ${ITK_INCLUDE_DIRS}
   ${X11_INCLUDE_DIR}
+  ${TCL_PRIVATE_HDRS}
+  # We can't realistically assume Itcl3 from any system install - just 
reference the local copy
   ${CMAKE_CURRENT_SOURCE_DIR}/../itcl/generic
   )
 
-# Like ITcl, Itk requires private Tcl headers, which we can't assume from a 
system
-# install of Tcl.  The workaround is to use our local copies and hope they
-# are workable. (Ugh.)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../tcl/generic)
-#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../tk/xlib)
-if(NOT WIN32)
-  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../tcl/unix)
-else(NOT WIN32)
-  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../tcl/win)
-endif(NOT WIN32)
-
 add_library(itk ${ITK_SRCS})
 target_link_libraries(itk ${M_LIBRARY} ${TCL_STUB_LIBRARY} ${TK_STUB_LIBRARY} 
${ITCL_STUB_LIBRARY})
 set_property(TARGET itk APPEND PROPERTY COMPILE_DEFINITIONS USE_TCL_STUBS)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to