Revision: 6429
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6429&view=rev
Author:   gbiggs
Date:     2008-05-11 20:45:27 -0700 (Sun, 11 May 2008)

Log Message:
-----------
Changed how the installed module macros take their arguments. Keyworded 
dynamic-length lists are now accepted, so empty arguments no longer need to be 
specified as "". Much nicer.

Modified Paths:
--------------
    code/player/trunk/CMake_Todo.txt
    code/player/trunk/cmake/CMakeLists.txt
    code/player/trunk/cmake/UsePlayerC++.cmake
    code/player/trunk/cmake/UsePlayerC.cmake
    code/player/trunk/cmake/UsePlayerPlugin.cmake
    code/player/trunk/cmake/internal/DriverUtils.cmake
    code/player/trunk/cmake/internal/LibraryUtils.cmake
    code/player/trunk/cmake/internal/SearchForStuff.cmake
    code/player/trunk/examples/libplayerc/CMakeLists.txt.example.in
    code/player/trunk/examples/libplayerc++/CMakeLists.txt.example.in
    code/player/trunk/examples/plugins/exampledriver/CMakeLists.txt.example.in
    
code/player/trunk/examples/plugins/exampleinterface/CMakeLists.txt.example.in
    code/player/trunk/examples/plugins/multidriver/CMakeLists.txt.example.in
    code/player/trunk/examples/plugins/opaquedriver/CMakeLists.txt.example.in
    code/player/trunk/utils/pmap/CMakeLists.txt

Added Paths:
-----------
    code/player/trunk/cmake/PlayerUtils.cmake

Removed Paths:
-------------
    code/player/trunk/cmake/internal/Utils.cmake

Modified: code/player/trunk/CMake_Todo.txt
===================================================================
--- code/player/trunk/CMake_Todo.txt    2008-05-12 02:21:34 UTC (rev 6428)
+++ code/player/trunk/CMake_Todo.txt    2008-05-12 03:45:27 UTC (rev 6429)
@@ -9,4 +9,5 @@
 - Clean out/replace any stragglers from autotools (including README and co)
 - Drivers being disabled by a check used to correctly force their option to 
off. Figure out why this broke. Fix it.
 - Figure out why C++ tests and C++ examples don't link properly when building 
as static libs, even though the server and utils do.
-- Add CMakeLists equivalent of the wavefront driver's Makefile.test (and get 
rid of Makefile.test)
\ No newline at end of file
+- Add CMakeLists equivalent of the wavefront driver's Makefile.test (and get 
rid of Makefile.test)
+- Interfaces don't get reprocessed when the .def files change. Probably 
because of the glob. Fix this.

Modified: code/player/trunk/cmake/CMakeLists.txt
===================================================================
--- code/player/trunk/cmake/CMakeLists.txt      2008-05-12 02:21:34 UTC (rev 
6428)
+++ code/player/trunk/cmake/CMakeLists.txt      2008-05-12 03:45:27 UTC (rev 
6429)
@@ -1,5 +1,6 @@
 SET (playerModules UsePlayerC.cmake
-                   UsePlayerPlugin.cmake)
+                   UsePlayerPlugin.cmake
+                   PlayerUtils.cmake)
 INSTALL (FILES ${playerModules} DESTINATION share/cmake/Modules/)
 
 IF (BUILD_PLAYERCC)

Copied: code/player/trunk/cmake/PlayerUtils.cmake (from rev 6428, 
code/player/trunk/cmake/internal/Utils.cmake)
===================================================================
--- code/player/trunk/cmake/PlayerUtils.cmake                           (rev 0)
+++ code/player/trunk/cmake/PlayerUtils.cmake   2008-05-12 03:45:27 UTC (rev 
6429)
@@ -0,0 +1,183 @@
+# Handy general utility macros
+
+###############################################################################
+# INSERT_INTO_MAP (_map _key _value)
+# Inserts an item into a map.
+MACRO (INSERT_INTO_MAP _map _key _value)
+    SET ("${_map}_${_key}" "${_value}")
+ENDMACRO (INSERT_INTO_MAP)
+
+
+###############################################################################
+# DELETE_FROM_MAP (_map _key)
+# Removes an item from a map.
+MACRO (DELETE_FROM_MAP _map _key)
+    SET ("${_map}_${_key}")
+ENDMACRO (DELETE_FROM_MAP)
+
+
+###############################################################################
+# GET_FROM_MAP (value _map _key)
+# Gets the value of a map entry and stores it in value.
+MACRO (GET_FROM_MAP value _map _key)
+    SET (${value} ${${_map}_${_key}})
+ENDMACRO (GET_FROM_MAP)
+
+
+###############################################################################
+# INSERT_INTO_GLOBAL_MAP (_map _key _value)
+# Inserts an item into a global map.
+MACRO (INSERT_INTO_GLOBAL_MAP _map _key _value)
+    SET ("${_map}_${_key}" "${_value}" CACHE INTERNAL "Map value" FORCE)
+ENDMACRO (INSERT_INTO_GLOBAL_MAP)
+
+
+###############################################################################
+# DELETE_FROM_GLOBAL_MAP (_map _key)
+# Removes an item from a global map.
+MACRO (DELETE_FROM_GLOBAL_MAP _map _key)
+    SET ("${_map}_${_key}" CACHE INTERNAL "Map value" FORCE)
+ENDMACRO (DELETE_FROM_GLOBAL_MAP)
+
+
+###############################################################################
+# GET_FROM_GLOBAL_MAP (value _map _key)
+# Gets the value of a global map entry and stores it in value.
+MACRO (GET_FROM_GLOBAL_MAP value _map _key)
+    SET (${value} ${${_map}_${_key}})
+ENDMACRO (GET_FROM_GLOBAL_MAP)
+
+
+###############################################################################
+# MAP_TO_LIST (result _indexList _mapName)
+# Converts a map indexed by the values in _indexList into a list.
+MACRO (MAP_TO_LIST result _indexList _mapName)
+    SET (${result})
+    FOREACH (key ${_indexList})
+        IF (${_mapName}_${key})
+            LIST (APPEND ${result} ${${_mapName}_${key}})
+        ENDIF (${_mapName}_${key})
+    ENDFOREACH (key ${_indexList})
+ENDMACRO (MAP_TO_LIST)
+
+
+###############################################################################
+# STRING_IN_LIST (_result _list _string)
+# Check if _string is already in _list, set _result to TRUE if it is.
+MACRO (STRING_IN_LIST _result _list _string)
+    SET (${_result} FALSE)
+    FOREACH (entry ${_list})
+        IF (${entry} STREQUAL ${_string})
+            SET (${_result} TRUE)
+        ENDIF (${entry} STREQUAL ${_string})
+    ENDFOREACH (entry ${_list})
+ENDMACRO (STRING_IN_LIST)
+
+
+###############################################################################
+# FILTER_DUPLICATES (_result _list)
+# Filters a list of strings, removing the duplicate strings.
+MACRO (FILTER_DUPLICATES _result _list)
+    SET (${_result})
+    FOREACH (newItem ${_list})
+        STRING_IN_LIST (_found "${${_result}}" ${newItem})
+        IF (NOT _found)
+            LIST (APPEND ${_result} ${newItem})
+        ENDIF (NOT _found)
+    ENDFOREACH (newItem ${_list})
+ENDMACRO (FILTER_DUPLICATES)
+
+
+###############################################################################
+# FILTER_EMPTY (_result _list)
+# Filters a list of strings, removing empty strings.
+MACRO (FILTER_EMPTY _result _list)
+    SET (${_result})
+    FOREACH (item ${_list})
+        SET (nonWhiteSpace)
+        STRING (REGEX MATCHALL "[^\t\n ]" nonWhiteSpace "${item}")
+        IF (nonWhiteSpace)
+            LIST (APPEND ${_result} ${item})
+        ENDIF (nonWhiteSpace)
+    ENDFOREACH (item ${_list})
+ENDMACRO (FILTER_EMPTY)
+
+
+###############################################################################
+# APPEND_TO_CACHED_LIST (_list _cacheDesc [items...])
+# Appends items to a cached list.
+MACRO (APPEND_TO_CACHED_LIST _list _cacheDesc)
+    SET (tempList ${${_list}})
+    FOREACH (newItem ${ARGN})
+        LIST (APPEND tempList ${newItem})
+    ENDFOREACH (newItem ${ARGN})
+    SET (${_list} ${tempList} CACHE INTERNAL ${_cacheDesc} FORCE)
+ENDMACRO (APPEND_TO_CACHED_LIST)
+
+
+###############################################################################
+# APPEND_TO_CACHED_STRING (_string _cacheDesc [items...])
+# Appends items to a cached list.
+MACRO (APPEND_TO_CACHED_STRING _string _cacheDesc)
+    FOREACH (newItem ${ARGN})
+        SET (${_string} "${${_string}} ${newItem}" CACHE INTERNAL 
${_cacheDesc} FORCE)
+    ENDFOREACH (newItem ${ARGN})
+ENDMACRO (APPEND_TO_CACHED_STRING)
+
+
+###############################################################################
+# Macro to look for a pkg-config package
+INCLUDE (UsePkgConfig)
+MACRO (CHECK_PACKAGE_EXISTS _package _result _includeDir _libDir _linkFlags 
_cFlags)
+    PKGCONFIG (${_package} ${_includeDir} ${_libDir} ${_linkFlags} ${_cFlags})
+    SET (${_result} FALSE)
+    IF (${_includeDir} OR ${_libDir} OR ${_linkFlags} OR ${_cFlags})
+        SET (${_result} TRUE)
+    ENDIF (${_includeDir} OR ${_libDir} OR ${_linkFlags} OR ${_cFlags})
+ENDMACRO (CHECK_PACKAGE_EXISTS)
+
+
+###############################################################################
+# Macro to turn a list into a string (why doesn't CMake have this built-in?)
+MACRO (LIST_TO_STRING _string _list)
+    SET (${_string})
+    FOREACH (_item ${_list})
+        SET (${_string} "${${_string}} ${_item}")
+    ENDFOREACH (_item)
+ENDMACRO (LIST_TO_STRING)
+
+
+###############################################################################
+# This macro processes a list of arguments into separate lists based on
+# keywords found in the argument stream. For example:
+# BUILDBLAG (miscArg INCLUDEDIRS /usr/include LIBDIRS /usr/local/lib
+#            LINKFLAGS -lthatawesomelib CFLAGS -DUSEAWESOMELIB SOURCES blag.c)
+# Any other args found at the start of the stream will go into the variable
+# specified in _otherArgs. Typically, you would take arguments to your macro
+# as normal, then pass ${ARGN} to this macro to parse the dynamic-length
+# arguments (so if ${_otherArgs} comes back non-empty, you've ignored something
+# or the user has passed in some arguments without a keyword).
+MACRO (PLAYER_PROCESS_ARGUMENTS _sourcesArgs _includeDirsArgs _libDirsArgs 
_linkFlagsArgs _cFlagsArgs _otherArgs)
+    SET (${_sourcesArgs})
+    SET (${_includeDirsArgs})
+    SET (${_libDirsArgs})
+    SET (${_linkFlagsArgs})
+    SET (${_cFlagsArgs})
+    SET (${_otherArgs})
+    SET (_currentDest ${_otherArgs})
+    FOREACH (_arg ${ARGN})
+        IF (_arg STREQUAL "SOURCES")
+            SET (_currentDest ${_sourcesArgs})
+        ELSEIF (_arg STREQUAL "INCLUDEDIRS")
+            SET (_currentDest ${_includeDirsArgs})
+        ELSEIF (_arg STREQUAL "LIBDIRS")
+            SET (_currentDest ${_libDirsArgs})
+        ELSEIF (_arg STREQUAL "LINKFLAGS")
+            SET (_currentDest ${_linkFlagsArgs})
+        ELSEIF (_arg STREQUAL "CFLAGS")
+            SET (_currentDest ${_cFlagsArgs})
+        ELSE (_arg STREQUAL "SOURCES")
+            LIST (APPEND ${_currentDest} ${_arg})
+        ENDIF (_arg STREQUAL "SOURCES")
+    ENDFOREACH (_arg)
+ENDMACRO (PLAYER_PROCESS_ARGUMENTS)

Modified: code/player/trunk/cmake/UsePlayerC++.cmake
===================================================================
--- code/player/trunk/cmake/UsePlayerC++.cmake  2008-05-12 02:21:34 UTC (rev 
6428)
+++ code/player/trunk/cmake/UsePlayerC++.cmake  2008-05-12 03:45:27 UTC (rev 
6429)
@@ -1,4 +1,5 @@
 CMAKE_MINIMUM_REQUIRED (VERSION 2.4 FATAL_ERROR)
+INCLUDE (PlayerUtils)
 
 INCLUDE (UsePkgConfig)
 PKGCONFIG (playerc++ PLAYERCPP_INC_DIR PLAYERCPP_LINK_DIR PLAYERCPP_LINK_FLAGS 
PLAYERCPP_CFLAGS)
@@ -12,17 +13,23 @@
     OUTPUT_VARIABLE PLAYERCPP_LIBDIR
     OUTPUT_STRIP_TRAILING_WHITESPACE)
 
-
 ###############################################################################
-# Macro to build a simple client. Pass all source files as extra arguments.
+# Macro to build a simple client.
 # _clientName: The name of the executable to create
-# _includeDirs, _libDirs, _linkFlags, _cFlags: extra include directories, lib
-# directories, global link flags and global compile flags necessary to compile
-# the client.
-MACRO (PLAYER_ADD_PLAYERCPP_CLIENT _clientName _includeDirs _libDirs 
_linkFlags _cFLags)
-    IF (NOT ${ARGC} GREATER 5)
-        MESSAGE (FATAL_ERROR "No sources specified to 
PLAYER_ADD_PLAYERCPP_CLIENT. Did you remember to include blank strings for 
unused arguments?")
-    ENDIF (NOT ${ARGC} GREATER 5)
+# Pass source files, flags, etc. as extra args preceded by keywords as follows:
+# SOURCES <source file list>
+# INCLUDEDIRS <include directories list>
+# LIBDIRS <library directories list>
+# LINKFLAGS <link flags list>
+# CFLAGS <compile flags list>
+# See the examples directory (typically, ${prefix}/share/player/examples) for
+# example CMakeLists.txt files.
+MACRO (PLAYER_ADD_PLAYERCPP_CLIENT _clientName)
+    PLAYER_PROCESS_ARGUMENTS (_srcs _includeDirs _libDirs _linkFlags _cFlags 
_junk ${ARGN})
+    IF (_junk)
+        MESSAGE (STATUS "WARNING: unkeyworded arguments found in 
PLAYER_ADD_PLAYERCPP_CLIENT: ${_junk}")
+    ENDIF (_junk)
+    LIST_TO_STRING (_cFlags "${_cFlags}")
 
     IF (_includeDirs OR PLAYERCPP_INC_DIR)
         INCLUDE_DIRECTORIES (${_includeDirs} ${PLAYERC_INC_DIR})
@@ -31,7 +38,7 @@
         LINK_DIRECTORIES (${_libDirs} ${PLAYERC_LINK_DIR})
     ENDIF (_libDirs OR PLAYERCPP_LINK_DIR)
 
-    ADD_EXECUTABLE (${_clientName} ${ARGN})
+    ADD_EXECUTABLE (${_clientName} ${_srcs})
     SET_TARGET_PROPERTIES (${_clientName} PROPERTIES
         LINK_FLAGS ${PLAYERCPP_LINK_FLAGS} ${_linkFlags}
         INSTALL_RPATH ${PLAYERCPP_LIBDIR}
@@ -40,16 +47,17 @@
     # Get the current cflags for each source file, and add the global ones
     # (this allows the user to specify individual cflags for each source file
     # without the global ones overriding them).
-    IF (PLAYERCPP_CFLAGS OR _cFLags)
-        FOREACH (_file ${ARGN})
+    IF (PLAYERCPP_CFLAGS OR _cFlags)
+        FOREACH (_file ${_srcs})
             GET_SOURCE_FILE_PROPERTY (_fileCFlags ${_file} COMPILE_FLAGS)
             IF (_fileCFlags STREQUAL NOTFOUND)
                 SET (_newCFlags "${PLAYERCPP_CFLAGS} ${_cFlags}")
             ELSE (_fileCFlags STREQUAL NOTFOUND)
                 SET (_newCFlags "${_fileCFlags} ${PLAYERCPP_CFLAGS} 
${_cFlags}")
             ENDIF (_fileCFlags STREQUAL NOTFOUND)
+            MESSAGE (STATUS "setting cflags to ${_newCFlags}")
             SET_SOURCE_FILES_PROPERTIES (${_file} PROPERTIES
                 COMPILE_FLAGS ${_newCFlags})
         ENDFOREACH (_file)
-    ENDIF (PLAYERCPP_CFLAGS OR _cFLags)
+    ENDIF (PLAYERCPP_CFLAGS OR _cFlags)
 ENDMACRO (PLAYER_ADD_PLAYERCPP_CLIENT)

Modified: code/player/trunk/cmake/UsePlayerC.cmake
===================================================================
--- code/player/trunk/cmake/UsePlayerC.cmake    2008-05-12 02:21:34 UTC (rev 
6428)
+++ code/player/trunk/cmake/UsePlayerC.cmake    2008-05-12 03:45:27 UTC (rev 
6429)
@@ -1,4 +1,5 @@
 CMAKE_MINIMUM_REQUIRED (VERSION 2.4 FATAL_ERROR)
+INCLUDE (PlayerUtils)
 
 INCLUDE (UsePkgConfig)
 PKGCONFIG (playerc PLAYERC_INC_DIR PLAYERC_LINK_DIR PLAYERC_LINK_FLAGS 
PLAYERC_CFLAGS)
@@ -13,16 +14,23 @@
     OUTPUT_STRIP_TRAILING_WHITESPACE)
 
 
-###############################################################################
-# Macro to build a simple client. Pass all source files as extra arguments.
+##############################################################################
+# Macro to build a simple client.
 # _clientName: The name of the executable to create
-# _includeDirs, _libDirs, _linkFlags, _cFlags: extra include directories, lib
-# directories, global link flags and global compile flags necessary to compile
-# the client.
-MACRO (PLAYER_ADD_PLAYERC_CLIENT _clientName _includeDirs _libDirs _linkFlags 
_cFLags)
-    IF (NOT ${ARGC} GREATER 5)
-        MESSAGE (FATAL_ERROR "No sources specified to 
PLAYER_ADD_PLAYERC_CLIENT. Did you remember to include blank strings for unused 
arguments?")
-    ENDIF (NOT ${ARGC} GREATER 5)
+# Pass source files, flags, etc. as extra args preceded by keywords as follows:
+# SOURCES <source file list>
+# INCLUDEDIRS <include directories list>
+# LIBDIRS <library directories list>
+# LINKFLAGS <link flags list>
+# CFLAGS <compile flags list>
+# See the examples directory (typically, ${prefix}/share/player/examples) for
+# example CMakeLists.txt files.
+MACRO (PLAYER_ADD_PLAYERC_CLIENT _clientName)
+    PLAYER_PROCESS_ARGUMENTS (_srcs _includeDirs _libDirs _linkFlags _cFLags 
_junk ${ARGN})
+    IF (_junk)
+        MESSAGE (STATUS "WARNING: unkeyworded arguments found in 
PLAYER_ADD_PLAYERC_CLIENT: ${_junk}")
+    ENDIF (_junk)
+    LIST_TO_STRING (_cFlags "${_cFlags}")
 
     IF (_includeDirs OR PLAYERC_INC_DIR)
         INCLUDE_DIRECTORIES (${_includeDirs} ${PLAYERC_INC_DIR})
@@ -31,7 +39,7 @@
         LINK_DIRECTORIES (${_libDirs} ${PLAYERC_LINK_DIR})
     ENDIF (_libDirs OR PLAYERC_LINK_DIR)
 
-    ADD_EXECUTABLE (${_clientName} ${ARGN})
+    ADD_EXECUTABLE (${_clientName} ${_srcs})
     SET_TARGET_PROPERTIES (${_clientName} PROPERTIES
         LINK_FLAGS ${PLAYERC_LINK_FLAGS} ${_linkFlags}
         INSTALL_RPATH ${PLAYERC_LIBDIR}
@@ -41,7 +49,7 @@
     # (this allows the user to specify individual cflags for each source file
     # without the global ones overriding them).
     IF (PLAYERC_CFLAGS OR _cFLags)
-        FOREACH (_file ${ARGN})
+        FOREACH (_file ${_srcs})
             GET_SOURCE_FILE_PROPERTY (_fileCFlags ${_file} COMPILE_FLAGS)
             IF (_fileCFlags STREQUAL NOTFOUND)
                 SET (_newCFlags "${PLAYERC_CFLAGS} ${_cFlags}")

Modified: code/player/trunk/cmake/UsePlayerPlugin.cmake
===================================================================
--- code/player/trunk/cmake/UsePlayerPlugin.cmake       2008-05-12 02:21:34 UTC 
(rev 6428)
+++ code/player/trunk/cmake/UsePlayerPlugin.cmake       2008-05-12 03:45:27 UTC 
(rev 6429)
@@ -1,4 +1,5 @@
 CMAKE_MINIMUM_REQUIRED (VERSION 2.4 FATAL_ERROR)
+INCLUDE (PlayerUtils)
 
 INCLUDE (UsePkgConfig)
 PKGCONFIG (playerc PLUGIN_PLAYERC_INC_DIR PLUGIN_PLAYERC_LINK_DIR 
PLUGIN_PLAYERC_LINK_FLAGS PLUGIN_PLAYERC_CFLAGS)
@@ -38,15 +39,22 @@
 
 
 ###############################################################################
-# Macro to build a plugin driver. Pass all source files as extra arguments.
+# Macro to build a plugin driver.
 # _driverName: The name of the driver library to create
-# _includeDirs, _libDirs, _linkFlags, _cFlags: extra include directories, lib
-# directories, global link flags and global compile flags necessary to compile
-# the driver.
-MACRO (PLAYER_ADD_PLUGIN_DRIVER _driverName _includeDirs _libDirs _linkFlags 
_cFLags)
-    IF (NOT ${ARGC} GREATER 5)
-        MESSAGE (FATAL_ERROR "No sources specified to 
PLAYER_ADD_PLUGIN_DRIVER. Did you remember to include blank strings for unused 
arguments?")
-    ENDIF (NOT ${ARGC} GREATER 5)
+# Pass source files, flags, etc. as extra args preceded by keywords as follows:
+# SOURCES <source file list>
+# INCLUDEDIRS <include directories list>
+# LIBDIRS <library directories list>
+# LINKFLAGS <link flags list>
+# CFLAGS <compile flags list>
+# See the examples directory (typically, ${prefix}/share/player/examples) for
+# example CMakeLists.txt files.
+MACRO (PLAYER_ADD_PLUGIN_DRIVER _driverName)
+    PLAYER_PROCESS_ARGUMENTS (_srcs _includeDirs _libDirs _linkFlags _cFlags 
_junk ${ARGN})
+    IF (_junk)
+        MESSAGE (STATUS "WARNING: unkeyworded arguments found in 
PLAYER_ADD_PLUGIN_DRIVER: ${_junk}")
+    ENDIF (_junk)
+    LIST_TO_STRING (_cFlags "${_cFlags}")
 
     IF (_includeDirs OR PLAYERCORE_INC_DIR)
         INCLUDE_DIRECTORIES (${_includeDirs} ${PLAYERC_INC_DIR})
@@ -55,7 +63,7 @@
         LINK_DIRECTORIES (${_libDirs} ${PLAYERC_LINK_DIR})
     ENDIF (_libDirs OR PLAYERCORE_LINK_DIR)
 
-    ADD_LIBRARY (${_driverName} SHARED ${ARGN})
+    ADD_LIBRARY (${_driverName} SHARED ${_srcs})
     SET_TARGET_PROPERTIES (${_driverName} PROPERTIES
         LINK_FLAGS ${PLAYERCORE_LINK_FLAGS} ${_linkFlags}
         INSTALL_RPATH ${PLAYERCORE_LIBDIR}
@@ -65,7 +73,7 @@
     # (this allows the user to specify individual cflags for each source file
     # without the global ones overriding them).
     IF (PLAYERCORE_CFLAGS OR _cFLags)
-        FOREACH (_file ${ARGN})
+        FOREACH (_file ${_srcs})
             GET_SOURCE_FILE_PROPERTY (_fileCFlags ${_file} COMPILE_FLAGS)
             IF (_fileCFlags STREQUAL NOTFOUND)
                 SET (_newCFlags "${PLAYERCORE_CFLAGS} ${_cFlags}")
@@ -80,23 +88,31 @@
 
 
 ###############################################################################
-# Macro to build a plugin interface. Pass all source files as extra arguments.
-# This macro will create generated sources prefixed with the
+# Macro to build a plugin interface.
+# This macro will create generated sources prefixed with the interface name
 # _interfName: The name of the interface library (not the interface itself!)
 #              to create
 # _interfDef: The interface definition file
-# _includeDirs, _libDirs, _linkFlags, _cFlags: extra include directories, lib
-# directories, global link flags and global compile flags necessary to compile
-# the driver.
+#
+# Pass source files, flags, etc. as extra args preceded by keywords as follows:
+# SOURCES <source file list>
+# INCLUDEDIRS <include directories list>
+# LIBDIRS <library directories list>
+# LINKFLAGS <link flags list>
+# CFLAGS <compile flags list>
+# See the examples directory (typically, ${prefix}/share/player/examples) for
+# example CMakeLists.txt files.
 INCLUDE (FindPythonInterp)
-MACRO (PLAYER_ADD_PLUGIN_INTERFACE _interfName _interfDef _includeDirs 
_libDirs _linkFlags _cFLags)
+MACRO (PLAYER_ADD_PLUGIN_INTERFACE _interfName _interfDef)
     IF (NOT PYTHONINTERP_FOUND)
         MESSAGE (FATAL_ERROR "No Python interpreter found. Cannot continue.")
     ENDIF (NOT PYTHONINTERP_FOUND)
 
-    IF (NOT ${ARGC} GREATER 6)
-        MESSAGE (FATAL_ERROR "No sources specified to 
PLAYER_ADD_PLUGIN_INTERFACE. Did you remember to include blank strings for 
unused arguments?")
-    ENDIF (NOT ${ARGC} GREATER 6)
+    PLAYER_PROCESS_ARGUMENTS (_srcs _includeDirs _libDirs _linkFlags _cFlags 
_junk ${ARGN})
+    IF (_junk)
+        MESSAGE (STATUS "WARNING: unkeyworded arguments found in 
PLAYER_ADD_PLUGIN_DRIVER: ${_junk}")
+    ENDIF (_junk)
+    LIST_TO_STRING (_cFlags "${_cFlags}")
 
     IF (_includeDirs OR PLUGIN_PLAYERC_INC_DIR)
         INCLUDE_DIRECTORIES (${_includeDirs} ${PLUGIN_PLAYERC_INC_DIR} 
${CMAKE_CURRENT_BINARY_DIR})
@@ -116,7 +132,7 @@
     PROCESS_XDR (${interface_h} ${xdr_h} ${xdr_c})
     SET_SOURCE_FILES_PROPERTIES (${xdr_c} PROPERTIES COMPILE_FLAGS 
${PLUGIN_PLAYERC_CFLAGS})
 
-    ADD_LIBRARY (${_interfName} SHARED ${interface_h} ${functiontable_c} 
${xdr_h} ${xdr_c} ${ARGN})
+    ADD_LIBRARY (${_interfName} SHARED ${interface_h} ${functiontable_c} 
${xdr_h} ${xdr_c} ${_srcs})
     SET_TARGET_PROPERTIES (${_interfName} PROPERTIES
         LINK_FLAGS ${PLUGIN_PLAYERC_LINK_FLAGS} ${_linkFlags}
         INSTALL_RPATH ${PLAYERCORE_LIBDIR}
@@ -126,7 +142,7 @@
     # (this allows the user to specify individual cflags for each source file
     # without the global ones overriding them).
     IF (PLAYERCORE_CFLAGS OR _cFLags)
-        FOREACH (_file ${ARGN})
+        FOREACH (_file ${_srcs})
             GET_SOURCE_FILE_PROPERTY (_fileCFlags ${_file} COMPILE_FLAGS)
             IF (_fileCFlags STREQUAL NOTFOUND)
                 SET (_newCFlags "${PLUGIN_PLAYERC_CFLAGS} ${_cFlags}")

Modified: code/player/trunk/cmake/internal/DriverUtils.cmake
===================================================================
--- code/player/trunk/cmake/internal/DriverUtils.cmake  2008-05-12 02:21:34 UTC 
(rev 6428)
+++ code/player/trunk/cmake/internal/DriverUtils.cmake  2008-05-12 03:45:27 UTC 
(rev 6429)
@@ -7,7 +7,7 @@
 # cross-directory bugs between those files, which is risky when we're having 
driver authors
 # maintain their own.
 
-INCLUDE (${PLAYER_CMAKE_DIR}/internal/Utils.cmake)
+INCLUDE (${PLAYER_CMAKE_DIR}/PlayerUtils.cmake)
 
 SET (PLAYER_BUILT_DRIVERS_DESC "List of drivers that will be built")
 SET (PLAYER_BUILT_DRIVEREXTRAS_DESC "List of extra components for 
playerdrivers that will be built")

Modified: code/player/trunk/cmake/internal/LibraryUtils.cmake
===================================================================
--- code/player/trunk/cmake/internal/LibraryUtils.cmake 2008-05-12 02:21:34 UTC 
(rev 6428)
+++ code/player/trunk/cmake/internal/LibraryUtils.cmake 2008-05-12 03:45:27 UTC 
(rev 6429)
@@ -1,5 +1,5 @@
 # Useful macros for building the Player libraries
-INCLUDE (${PLAYER_CMAKE_DIR}/internal/Utils.cmake)
+INCLUDE (${PLAYER_CMAKE_DIR}/PlayerUtils.cmake)
 
 ###############################################################################
 # PLAYER_ADD_LIBRARY (_name)

Modified: code/player/trunk/cmake/internal/SearchForStuff.cmake
===================================================================
--- code/player/trunk/cmake/internal/SearchForStuff.cmake       2008-05-12 
02:21:34 UTC (rev 6428)
+++ code/player/trunk/cmake/internal/SearchForStuff.cmake       2008-05-12 
03:45:27 UTC (rev 6429)
@@ -1,4 +1,4 @@
-INCLUDE (${PLAYER_CMAKE_DIR}/internal/Utils.cmake)
+INCLUDE (${PLAYER_CMAKE_DIR}/PlayerUtils.cmake)
 
 INCLUDE (CheckFunctionExists)
 INCLUDE (CheckIncludeFiles)

Deleted: code/player/trunk/cmake/internal/Utils.cmake
===================================================================
--- code/player/trunk/cmake/internal/Utils.cmake        2008-05-12 02:21:34 UTC 
(rev 6428)
+++ code/player/trunk/cmake/internal/Utils.cmake        2008-05-12 03:45:27 UTC 
(rev 6429)
@@ -1,137 +0,0 @@
-# Handy general utility macros
-
-###############################################################################
-# INSERT_INTO_MAP (_map _key _value)
-# Inserts an item into a map.
-MACRO (INSERT_INTO_MAP _map _key _value)
-    SET ("${_map}_${_key}" "${_value}")
-ENDMACRO (INSERT_INTO_MAP)
-
-
-###############################################################################
-# DELETE_FROM_MAP (_map _key)
-# Removes an item from a map.
-MACRO (DELETE_FROM_MAP _map _key)
-    SET ("${_map}_${_key}")
-ENDMACRO (DELETE_FROM_MAP)
-
-
-###############################################################################
-# GET_FROM_MAP (value _map _key)
-# Gets the value of a map entry and stores it in value.
-MACRO (GET_FROM_MAP value _map _key)
-    SET (${value} ${${_map}_${_key}})
-ENDMACRO (GET_FROM_MAP)
-
-
-###############################################################################
-# INSERT_INTO_GLOBAL_MAP (_map _key _value)
-# Inserts an item into a global map.
-MACRO (INSERT_INTO_GLOBAL_MAP _map _key _value)
-    SET ("${_map}_${_key}" "${_value}" CACHE INTERNAL "Map value" FORCE)
-ENDMACRO (INSERT_INTO_GLOBAL_MAP)
-
-
-###############################################################################
-# DELETE_FROM_GLOBAL_MAP (_map _key)
-# Removes an item from a global map.
-MACRO (DELETE_FROM_GLOBAL_MAP _map _key)
-    SET ("${_map}_${_key}" CACHE INTERNAL "Map value" FORCE)
-ENDMACRO (DELETE_FROM_GLOBAL_MAP)
-
-
-###############################################################################
-# GET_FROM_GLOBAL_MAP (value _map _key)
-# Gets the value of a global map entry and stores it in value.
-MACRO (GET_FROM_GLOBAL_MAP value _map _key)
-    SET (${value} ${${_map}_${_key}})
-ENDMACRO (GET_FROM_GLOBAL_MAP)
-
-
-###############################################################################
-# MAP_TO_LIST (result _indexList _mapName)
-# Converts a map indexed by the values in _indexList into a list.
-MACRO (MAP_TO_LIST result _indexList _mapName)
-    SET (${result})
-    FOREACH (key ${_indexList})
-        IF (${_mapName}_${key})
-            LIST (APPEND ${result} ${${_mapName}_${key}})
-        ENDIF (${_mapName}_${key})
-    ENDFOREACH (key ${_indexList})
-ENDMACRO (MAP_TO_LIST)
-
-
-###############################################################################
-# STRING_IN_LIST (_result _list _string)
-# Check if _string is already in _list, set _result to TRUE if it is.
-MACRO (STRING_IN_LIST _result _list _string)
-    SET (${_result} FALSE)
-    FOREACH (entry ${_list})
-        IF (${entry} STREQUAL ${_string})
-            SET (${_result} TRUE)
-        ENDIF (${entry} STREQUAL ${_string})
-    ENDFOREACH (entry ${_list})
-ENDMACRO (STRING_IN_LIST)
-
-
-###############################################################################
-# FILTER_DUPLICATES (_result _list)
-# Filters a list of strings, removing the duplicate strings.
-MACRO (FILTER_DUPLICATES _result _list)
-    SET (${_result})
-    FOREACH (newItem ${_list})
-        STRING_IN_LIST (_found "${${_result}}" ${newItem})
-        IF (NOT _found)
-            LIST (APPEND ${_result} ${newItem})
-        ENDIF (NOT _found)
-    ENDFOREACH (newItem ${_list})
-ENDMACRO (FILTER_DUPLICATES)
-
-
-###############################################################################
-# FILTER_EMPTY (_result _list)
-# Filters a list of strings, removing empty strings.
-MACRO (FILTER_EMPTY _result _list)
-    SET (${_result})
-    FOREACH (item ${_list})
-        SET (nonWhiteSpace)
-        STRING (REGEX MATCHALL "[^\t\n ]" nonWhiteSpace "${item}")
-        IF (nonWhiteSpace)
-            LIST (APPEND ${_result} ${item})
-        ENDIF (nonWhiteSpace)
-    ENDFOREACH (item ${_list})
-ENDMACRO (FILTER_EMPTY)
-
-
-###############################################################################
-# APPEND_TO_CACHED_LIST (_list _cacheDesc [items...])
-# Appends items to a cached list.
-MACRO (APPEND_TO_CACHED_LIST _list _cacheDesc)
-    SET (tempList ${${_list}})
-    FOREACH (newItem ${ARGN})
-        LIST (APPEND tempList ${newItem})
-    ENDFOREACH (newItem ${ARGN})
-    SET (${_list} ${tempList} CACHE INTERNAL ${_cacheDesc} FORCE)
-ENDMACRO (APPEND_TO_CACHED_LIST)
-
-
-###############################################################################
-# APPEND_TO_CACHED_STRING (_string _cacheDesc [items...])
-# Appends items to a cached list.
-MACRO (APPEND_TO_CACHED_STRING _string _cacheDesc)
-    FOREACH (newItem ${ARGN})
-        SET (${_string} "${${_string}} ${newItem}" CACHE INTERNAL 
${_cacheDesc} FORCE)
-    ENDFOREACH (newItem ${ARGN})
-ENDMACRO (APPEND_TO_CACHED_STRING)
-
-
-###############################################################################
-# Macro to look for a pkg-config package
-INCLUDE (UsePkgConfig)
-MACRO (CHECK_PACKAGE_EXISTS _package _result _includeDir _libDir _linkFlags 
_cFlags)
-    PKGCONFIG (${_package} ${_includeDir} ${_libDir} ${_linkFlags} ${_cFlags})
-    SET (${_result} FALSE)
-    IF (${_includeDir} OR ${_libDir} OR ${_linkFlags} OR ${_cFlags})
-        SET (${_result} TRUE)
-    ENDIF (${_includeDir} OR ${_libDir} OR ${_linkFlags} OR ${_cFlags})
-ENDMACRO (CHECK_PACKAGE_EXISTS)

Modified: code/player/trunk/examples/libplayerc/CMakeLists.txt.example.in
===================================================================
--- code/player/trunk/examples/libplayerc/CMakeLists.txt.example.in     
2008-05-12 02:21:34 UTC (rev 6428)
+++ code/player/trunk/examples/libplayerc/CMakeLists.txt.example.in     
2008-05-12 03:45:27 UTC (rev 6429)
@@ -4,8 +4,8 @@
 SET (CMAKE_MODULE_PATH @CMAKE_INSTALL_PREFIX@/share/cmake/Modules)
 INCLUDE (UsePlayerC)
 
-PLAYER_ADD_PLAYERC_CLIENT (simple "" "" "" "" simple.c)
+PLAYER_ADD_PLAYERC_CLIENT (simple SOURCES simple.c)
 
-PLAYER_ADD_PLAYERC_CLIENT (vmap "" "" "" "" vmap.c)
+PLAYER_ADD_PLAYERC_CLIENT (vmap SOURCES vmap.c)
 
-PLAYER_ADD_PLAYERC_CLIENT (speech_c_client "" "" "" "" speech_c_client.c)
\ No newline at end of file
+PLAYER_ADD_PLAYERC_CLIENT (speech_c_client SOURCES speech_c_client.c)
\ No newline at end of file

Modified: code/player/trunk/examples/libplayerc++/CMakeLists.txt.example.in
===================================================================
--- code/player/trunk/examples/libplayerc++/CMakeLists.txt.example.in   
2008-05-12 02:21:34 UTC (rev 6428)
+++ code/player/trunk/examples/libplayerc++/CMakeLists.txt.example.in   
2008-05-12 03:45:27 UTC (rev 6429)
@@ -4,29 +4,29 @@
 SET (CMAKE_MODULE_PATH @CMAKE_INSTALL_PREFIX@/share/cmake/Modules)
 INCLUDE (UsePlayerC++)
 
-PLAYER_ADD_PLAYERCPP_CLIENT (camera "" "" "" "" camera.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (example0 "" "" "" "" example0.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (example4 "" "" "" "" example4.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (grip "" "" "" "" grip.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (clientgraphics "" "" "" "" clientgraphics.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (clientgraphics3d "" "" "" "" clientgraphics3d.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (laserobstacleavoid "" "" "" "" 
laserobstacleavoid.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (ptz "" "" "" "" ptz.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (randomwalk "" "" "" "" randomwalk.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (sonarobstacleavoid "" "" "" "" 
sonarobstacleavoid.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (speed "" "" "" "" speech.cc)
-PLAYER_ADD_PLAYERCPP_CLIENT (wallfollow "" "" "" "" wallfollow.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (camera SOURCES camera.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (example0 SOURCES example0.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (example4 SOURCES example4.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (grip SOURCES grip.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (clientgraphics SOURCES clientgraphics.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (clientgraphics3d SOURCES clientgraphics3d.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (laserobstacleavoid SOURCES laserobstacleavoid.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (ptz SOURCES ptz.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (randomwalk SOURCES randomwalk.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (sonarobstacleavoid SOURCES sonarobstacleavoid.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (speed SOURCES speech.cc)
+PLAYER_ADD_PLAYERCPP_CLIENT (wallfollow SOURCES wallfollow.cc)
 
 SET (HAVE_BOOST_THREADS @USE_BOOST_THREADS@)
 SET (HAVE_BOOST_SIGNALS @USE_BOOST_SIGNALS@)
 
 IF (HAVE_BOOST_THREADS OR HAVE_BOOST_SIGNALS)
-    PLAYER_ADD_PLAYERCPP_CLIENT (example1 "" "" "" "" example1.cc)
-    PLAYER_ADD_PLAYERCPP_CLIENT (example3 "" "" "" "" example3.cc)
-    PLAYER_ADD_PLAYERCPP_CLIENT (goto "" "" "" "-DHAVE_BOOST_THREAD 
-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DHAVE_BOOST_SIGNALS" goto.cc)
-    PLAYER_ADD_PLAYERCPP_CLIENT (speech_cpp_client "" "" "" "" 
speech_cpp_client.cc)
+    PLAYER_ADD_PLAYERCPP_CLIENT (example1 SOURCES example1.cc)
+    PLAYER_ADD_PLAYERCPP_CLIENT (example3 SOURCES example3.cc)
+    PLAYER_ADD_PLAYERCPP_CLIENT (goto SOURCES goto.cc CFLAGS 
-DHAVE_BOOST_THREAD -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT 
-DHAVE_BOOST_SIGNALS)
+    PLAYER_ADD_PLAYERCPP_CLIENT (speech_cpp_client SOURCES 
speech_cpp_client.cc)
 ENDIF (HAVE_BOOST_THREADS OR HAVE_BOOST_SIGNALS)
 
 IF (HAVE_BOOST_SIGNALS)
-    PLAYER_ADD_PLAYERCPP_CLIENT (example2 "" "" "" "" example2.cc)
+    PLAYER_ADD_PLAYERCPP_CLIENT (example2 SOURCES example2.cc)
 ENDIF (HAVE_BOOST_SIGNALS)
\ No newline at end of file

Modified: 
code/player/trunk/examples/plugins/exampledriver/CMakeLists.txt.example.in
===================================================================
--- code/player/trunk/examples/plugins/exampledriver/CMakeLists.txt.example.in  
2008-05-12 02:21:34 UTC (rev 6428)
+++ code/player/trunk/examples/plugins/exampledriver/CMakeLists.txt.example.in  
2008-05-12 03:45:27 UTC (rev 6429)
@@ -4,4 +4,4 @@
 SET (CMAKE_MODULE_PATH @CMAKE_INSTALL_PREFIX@/share/cmake/Modules)
 INCLUDE (UsePlayerPlugin)
 
-PLAYER_ADD_PLUGIN_DRIVER (exampledriver "" "" "" "" exampledriver.cc)
\ No newline at end of file
+PLAYER_ADD_PLUGIN_DRIVER (exampledriver SOURCES exampledriver.cc)
\ No newline at end of file

Modified: 
code/player/trunk/examples/plugins/exampleinterface/CMakeLists.txt.example.in
===================================================================
--- 
code/player/trunk/examples/plugins/exampleinterface/CMakeLists.txt.example.in   
    2008-05-12 02:21:34 UTC (rev 6428)
+++ 
code/player/trunk/examples/plugins/exampleinterface/CMakeLists.txt.example.in   
    2008-05-12 03:45:27 UTC (rev 6429)
@@ -5,8 +5,8 @@
 INCLUDE (UsePlayerPlugin)
 INCLUDE (UsePlayerC)
 
-PLAYER_ADD_PLUGIN_INTERFACE (example 128_example.def "" "" "" "" 
eginterf_client.c)
+PLAYER_ADD_PLUGIN_INTERFACE (example 128_example.def SOURCES eginterf_client.c)
 # Note the use of files generated during the PLAYER_ADD_PLUGIN_INTERFACE step
-PLAYER_ADD_PLUGIN_DRIVER (example_driver "" "" "" "" eginterf_driver.cc 
example_interface.h example_xdr.h)
-PLAYER_ADD_PLAYERC_CLIENT (example_client "" "" "" "" example_client.c 
example_interface.h)
+PLAYER_ADD_PLUGIN_DRIVER (example_driver SOURCES eginterf_driver.cc 
example_interface.h example_xdr.h)
+PLAYER_ADD_PLAYERC_CLIENT (example_client SOURCES example_client.c 
example_interface.h)
 TARGET_LINK_LIBRARIES (example_client example)
\ No newline at end of file

Modified: 
code/player/trunk/examples/plugins/multidriver/CMakeLists.txt.example.in
===================================================================
--- code/player/trunk/examples/plugins/multidriver/CMakeLists.txt.example.in    
2008-05-12 02:21:34 UTC (rev 6428)
+++ code/player/trunk/examples/plugins/multidriver/CMakeLists.txt.example.in    
2008-05-12 03:45:27 UTC (rev 6429)
@@ -4,4 +4,4 @@
 SET (CMAKE_MODULE_PATH @CMAKE_INSTALL_PREFIX@/share/cmake/Modules)
 INCLUDE (UsePlayerPlugin)
 
-PLAYER_ADD_PLUGIN_DRIVER (multidriver "" "" "" "" multidriver.cc)
\ No newline at end of file
+PLAYER_ADD_PLUGIN_DRIVER (multidriver SOURCES multidriver.cc)
\ No newline at end of file

Modified: 
code/player/trunk/examples/plugins/opaquedriver/CMakeLists.txt.example.in
===================================================================
--- code/player/trunk/examples/plugins/opaquedriver/CMakeLists.txt.example.in   
2008-05-12 02:21:34 UTC (rev 6428)
+++ code/player/trunk/examples/plugins/opaquedriver/CMakeLists.txt.example.in   
2008-05-12 03:45:27 UTC (rev 6429)
@@ -5,5 +5,5 @@
 INCLUDE (UsePlayerPlugin)
 INCLUDE (UsePlayerC)
 
-PLAYER_ADD_PLUGIN_DRIVER (opaquedriver "" "" "" "" opaquedriver.cc)
-PLAYER_ADD_PLAYERC_CLIENT (opaque "" "" "" "" opaque.c)
\ No newline at end of file
+PLAYER_ADD_PLUGIN_DRIVER (opaquedriver SOURCES opaquedriver.cc)
+PLAYER_ADD_PLAYERC_CLIENT (opaque SOURCES opaque.c)
\ No newline at end of file

Modified: code/player/trunk/utils/pmap/CMakeLists.txt
===================================================================
--- code/player/trunk/utils/pmap/CMakeLists.txt 2008-05-12 02:21:34 UTC (rev 
6428)
+++ code/player/trunk/utils/pmap/CMakeLists.txt 2008-05-12 03:45:27 UTC (rev 
6429)
@@ -1,4 +1,4 @@
-INCLUDE (${PLAYER_CMAKE_DIR}/internal/Utils.cmake)
+INCLUDE (${PLAYER_CMAKE_DIR}/PlayerUtils.cmake)
 
 CHECK_PACKAGE_EXISTS (gsl haveGSL gslIncludeDir gslLibDir gslLinkFlags 
gslCFlags)
 # The GSL pkg-config gives an almost-empty cflags, containing only a new line.


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

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to