From 786b291d9c6b784c7ce6ceef0e38a4ec76ea14db Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 6 Apr 2022 16:32:52 +0200 Subject: Move CMake files to modernized cmake syntax, step 1. Change projects to cmake targetsto get rid of havig to hardcore include directories and link libraries in consumer projects. --- indra/cmake/NDOF.cmake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/cmake/NDOF.cmake') diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index 388df16a52..f22e2246aa 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -3,6 +3,11 @@ include(Prebuilt) set(NDOF ON CACHE BOOL "Use NDOF space navigator joystick library.") +if ( TARGET ndof::ndof ) + return() +endif() +create_target( ndof::ndof ) + if (NDOF) if (USESYSTEMLIBS) set(NDOF_FIND_REQUIRED ON) @@ -15,22 +20,17 @@ if (NDOF) endif (WINDOWS OR DARWIN) if (WINDOWS) - set(NDOF_LIBRARY libndofdev) + set_target_libraries( ndof::ndof libndofdev) elseif (DARWIN OR LINUX) - set(NDOF_LIBRARY ndofdev) + set_target_libraries( ndof::ndof ndofdev) endif (WINDOWS) - - set(NDOF_INCLUDE_DIR ${ARCH_PREBUILT_DIRS}/include/ndofdev) set(NDOF_FOUND 1) endif (USESYSTEMLIBS) endif (NDOF) if (NDOF_FOUND) add_definitions(-DLIB_NDOF=1) - include_directories(${NDOF_INCLUDE_DIR}) else (NDOF_FOUND) message(STATUS "Building without N-DoF joystick support") - set(NDOF_INCLUDE_DIR "") - set(NDOF_LIBRARY "") endif (NDOF_FOUND) -- cgit v1.2.3 From 07d388f416b64ad5ea6a79d7dee4bf9e6bab7b74 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 10 Apr 2022 23:43:15 +0200 Subject: Make LIB_NDOF define part of the targets interface --- indra/cmake/NDOF.cmake | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/cmake/NDOF.cmake') diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index f22e2246aa..7b64b23299 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -24,13 +24,11 @@ if (NDOF) elseif (DARWIN OR LINUX) set_target_libraries( ndof::ndof ndofdev) endif (WINDOWS) - set(NDOF_FOUND 1) + target_compile_definitions( ndof::ndof INTERFACE LIB_NDOF=1) endif (USESYSTEMLIBS) endif (NDOF) -if (NDOF_FOUND) - add_definitions(-DLIB_NDOF=1) -else (NDOF_FOUND) +if (NOT NDOF_FOUND) message(STATUS "Building without N-DoF joystick support") -endif (NDOF_FOUND) +endif () -- cgit v1.2.3 From d3521b4462195cfe882b2cc8eb4e7c5e948c0fb6 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 13 Apr 2022 10:28:46 +0200 Subject: Remove obsolete and unmaintained USE_SYSTEMLIBS --- indra/cmake/NDOF.cmake | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'indra/cmake/NDOF.cmake') diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index 7b64b23299..e5ec962f4c 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -9,23 +9,18 @@ endif() create_target( ndof::ndof ) if (NDOF) - if (USESYSTEMLIBS) - set(NDOF_FIND_REQUIRED ON) - include(FindNDOF) - else (USESYSTEMLIBS) - if (WINDOWS OR DARWIN) - use_prebuilt_binary(libndofdev) - elseif (LINUX) - use_prebuilt_binary(open-libndofdev) - endif (WINDOWS OR DARWIN) + if (WINDOWS OR DARWIN) + use_prebuilt_binary(libndofdev) + elseif (LINUX) + use_prebuilt_binary(open-libndofdev) + endif (WINDOWS OR DARWIN) - if (WINDOWS) - set_target_libraries( ndof::ndof libndofdev) - elseif (DARWIN OR LINUX) - set_target_libraries( ndof::ndof ndofdev) - endif (WINDOWS) - target_compile_definitions( ndof::ndof INTERFACE LIB_NDOF=1) - endif (USESYSTEMLIBS) + if (WINDOWS) + set_target_libraries( ndof::ndof libndofdev) + elseif (DARWIN OR LINUX) + set_target_libraries( ndof::ndof ndofdev) + endif (WINDOWS) + target_compile_definitions( ndof::ndof INTERFACE LIB_NDOF=1) endif (NDOF) if (NOT NDOF_FOUND) -- cgit v1.2.3 From 241919e7f7986c11586a49bff53cf19c2c0e0ea6 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 13 Apr 2022 19:21:55 +0200 Subject: Rework cmake, the original plan was to maybe be able to use conan targets with the same name (that's why 3ps had names like apr::apr), but it's safer and saner to put the LL 3ps under the ll:: prefix. This also allows means it is possible to get rid of that bad "if( TRAGET ...) return() endif()" pattern and rather use include_guard(). --- indra/cmake/NDOF.cmake | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'indra/cmake/NDOF.cmake') diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index e5ec962f4c..75936425ff 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -3,10 +3,8 @@ include(Prebuilt) set(NDOF ON CACHE BOOL "Use NDOF space navigator joystick library.") -if ( TARGET ndof::ndof ) - return() -endif() -create_target( ndof::ndof ) +include_guard() +create_target( ll::ndof ) if (NDOF) if (WINDOWS OR DARWIN) @@ -16,11 +14,11 @@ if (NDOF) endif (WINDOWS OR DARWIN) if (WINDOWS) - set_target_libraries( ndof::ndof libndofdev) + set_target_libraries( ll::ndof libndofdev) elseif (DARWIN OR LINUX) - set_target_libraries( ndof::ndof ndofdev) + set_target_libraries( ll::ndof ndofdev) endif (WINDOWS) - target_compile_definitions( ndof::ndof INTERFACE LIB_NDOF=1) + target_compile_definitions( ll::ndof INTERFACE LIB_NDOF=1) endif (NDOF) if (NOT NDOF_FOUND) -- cgit v1.2.3 From e45a6a0f689d12659ccb1d323e0fa6d791c2a74e Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 16 Apr 2022 15:35:41 +0200 Subject: Remove obsolete message --- indra/cmake/NDOF.cmake | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/cmake/NDOF.cmake') diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index 75936425ff..fd7a650612 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -21,7 +21,4 @@ if (NDOF) target_compile_definitions( ll::ndof INTERFACE LIB_NDOF=1) endif (NDOF) -if (NOT NDOF_FOUND) - message(STATUS "Building without N-DoF joystick support") -endif () -- cgit v1.2.3 From 6d0bba9c03da0d8aca5e88fcb9289cb2f89f3467 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 17:32:14 +0200 Subject: Switch over to standard target_link_libraries (cmake requirements are high enough now). --- indra/cmake/NDOF.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/cmake/NDOF.cmake') diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index fd7a650612..6daf0e0741 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -14,9 +14,9 @@ if (NDOF) endif (WINDOWS OR DARWIN) if (WINDOWS) - set_target_libraries( ll::ndof libndofdev) + target_link_libraries( ll::ndof INTERFACE libndofdev) elseif (DARWIN OR LINUX) - set_target_libraries( ll::ndof ndofdev) + target_link_libraries( ll::ndof INTERFACE ndofdev) endif (WINDOWS) target_compile_definitions( ll::ndof INTERFACE LIB_NDOF=1) endif (NDOF) -- cgit v1.2.3 From 363f2df4fa22b3eb95ff4603d73b7a042f3fefd1 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 18:28:55 +0200 Subject: Remove function create_target and instead directly use add_library --- indra/cmake/NDOF.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/NDOF.cmake') diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake index 6daf0e0741..b88fbccf2a 100644 --- a/indra/cmake/NDOF.cmake +++ b/indra/cmake/NDOF.cmake @@ -4,7 +4,7 @@ include(Prebuilt) set(NDOF ON CACHE BOOL "Use NDOF space navigator joystick library.") include_guard() -create_target( ll::ndof ) +add_library( ll::ndof INTERFACE IMPORTED ) if (NDOF) if (WINDOWS OR DARWIN) -- cgit v1.2.3