[Cmake] FIND_FILE

Andy Cedilnik andy . cedilnik at kitware . com
25 Jun 2003 08:06:54 -0400


Hi Niel,

On Wed, 2003-06-25 at 07:54, Neil Killeen wrote:
> I've been wanting this particular variable for a long time !
> I don't suppose there is an uptodate list of CMake's predefined
> variables
> squirreled away anywhere on the CMAKe site ?  I can't find it...

Ok, there is no really good list of all variables. Unfortunately there
is no really good way of figuring out all the variables in CMake 1.6.

In 1.7 you can however probe for it. This is what SystemInformation test
does:

WRITE_FILE(${DumpInformation_BINARY_DIR}/AllVariables.txt "")

GET_CMAKE_PROPERTY(VARS VARIABLES)

FOREACH(var ${VARS})
  WRITE_FILE(${DumpInformation_BINARY_DIR}/AllVariables.txt 
             "${var} \"${${var}}\"" APPEND)
ENDFOREACH(var ${VARS})

Unfortunately GET_CMAKE_PROPERTY is the new feature and will not be
there until 1.8.

Just FYI, here are variables from 1.8 on CYGWIN machine:

#CMake Variables are:
CMAKE_AR "/usr/bin/ar"
CMAKE_BACKWARDS_COMPATIBILITY "1.7"
CMAKE_BASE_NAME "g++"
CMAKE_BINARY_DIR "/cygdrive/c/hoffman/CMake-gcc-dashboard/Tests/SystemInformation"
CMAKE_BUILD_TOOL "/usr/bin/make"
CMAKE_BUILD_TYPE ""
CMAKE_CACHEFILE_DIR "/cygdrive/c/hoffman/CMake-gcc-dashboard/Tests/SystemInformation"
CMAKE_CACHE_MAJOR_VERSION "1"
CMAKE_CACHE_MINOR_VERSION "7"
CMAKE_CACHE_RELEASE_VERSION "development"
CMAKE_CFG_INTDIR "."
CMAKE_COMMAND "/cygdrive/c/hoffman/CMake-gcc-dashboard/bin/cmake.exe"
CMAKE_COMPILER_IS_GNUCC "1"
CMAKE_COMPILER_IS_GNUCXX "1"
CMAKE_CURRENT_BINARY_DIR "/cygdrive/c/hoffman/CMake-gcc-dashboard/Tests/SystemInformation"
CMAKE_CURRENT_SOURCE_DIR "/cygdrive/c/hoffman/CMakeDashboardSrc/Tests/SystemInformation"
CMAKE_CXX_COMPILER "c++"
CMAKE_CXX_COMPILER_FULLPATH "/usr/bin/c++"
CMAKE_CXX_COMPILER_LOADED "1"
CMAKE_CXX_COMPILER_WORKS "TRUE"
CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> -o <OBJECT> <FLAGS> -c <SOURCE>"
CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> ;<CMAKE_RANLIB> <TARGET> "
CMAKE_CXX_FLAGS " -g "
CMAKE_CXX_FLAGS_DEBUG "-g"
CMAKE_CXX_FLAGS_DEBUG_INIT "-g"
CMAKE_CXX_FLAGS_INIT ""
CMAKE_CXX_FLAGS_MINSIZEREL "-Os"
CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os"
CMAKE_CXX_FLAGS_RELEASE "-O3"
CMAKE_CXX_FLAGS_RELEASE_INIT "-O3"
CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g"
CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g"
CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>"
CMAKE_C_COMPILER "gcc"
CMAKE_C_COMPILER_FULLPATH "/usr/bin/gcc"
CMAKE_C_COMPILER_LOADED "1"
CMAKE_C_COMPILER_WORKS "TRUE"
CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> -o <OBJECT>  <FLAGS> -c <SOURCE>"
CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
CMAKE_C_CREATE_SHARED_MODULE "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> ;<CMAKE_RANLIB> <TARGET> "
CMAKE_C_FLAGS "  "
CMAKE_C_FLAGS_DEBUG "-g"
CMAKE_C_FLAGS_DEBUG_INIT "-g"
CMAKE_C_FLAGS_INIT ""
CMAKE_C_FLAGS_MINSIZEREL "-Os"
CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os"
CMAKE_C_FLAGS_RELEASE "-O3"
CMAKE_C_FLAGS_RELEASE_INIT "-O3"
CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g"
CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g"
CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>"
CMAKE_DL_LIBS "-lgdi32"
CMAKE_EDIT_COMMAND "/cygdrive/c/hoffman/CMake-gcc-dashboard/bin/ccmake.exe"
CMAKE_EXE_LINKER_FLAGS ""
CMAKE_EXE_LINKER_FLAGS_DEBUG ""
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL ""
CMAKE_EXE_LINKER_FLAGS_RELEASE ""
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ""
CMAKE_GENERATOR "Unix Makefiles"
CMAKE_HOME_DIRECTORY "/cygdrive/c/hoffman/CMakeDashboardSrc/Tests/SystemInformation"
CMAKE_INSTALL_PREFIX "/usr/local"
CMAKE_LIBRARY_PATH_FLAG "-L"
CMAKE_LINK_LIBRARY_FLAG "-l"
CMAKE_LINK_LIBRARY_SUFFIX ""
CMAKE_MAJOR_VERSION "1"
CMAKE_MAKE_PROGRAM "/usr/bin/make"
CMAKE_MINOR_VERSION "7"
CMAKE_MODULE_LINKER_FLAGS ""
CMAKE_MODULE_LINKER_FLAGS_DEBUG ""
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL ""
CMAKE_MODULE_LINKER_FLAGS_RELEASE ""
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO ""
CMAKE_RANLIB "/usr/bin/ranlib"
CMAKE_ROOT "/cygdrive/c/hoffman/CMakeDashboardSrc"
CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import"
CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import"
CMAKE_SHARED_LIBRARY_C_FLAGS ""
CMAKE_SHARED_LIBRARY_LINK_FLAGS ""
CMAKE_SHARED_LIBRARY_PREFIX "lib"
CMAKE_SHARED_LIBRARY_RUNTIME_FLAG ""
CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ""
CMAKE_SHARED_LIBRARY_SUFFIX ".dll"
CMAKE_SHARED_LINKER_FLAGS ""
CMAKE_SHARED_LINKER_FLAGS_DEBUG ""
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL ""
CMAKE_SHARED_LINKER_FLAGS_RELEASE ""
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ""
CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import"
CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import"
CMAKE_SHARED_MODULE_PREFIX "lib"
CMAKE_SHARED_MODULE_SUFFIX ".dll"
CMAKE_SKIP_RPATH "NO"
CMAKE_SOURCE_DIR "/cygdrive/c/hoffman/CMakeDashboardSrc/Tests/SystemInformation"
CMAKE_STATIC_LIBRARY_PREFIX "lib"
CMAKE_STATIC_LIBRARY_SUFFIX ".a"
CMAKE_SYSTEM "CYGWIN-1.3.22(0.78/3/2)"
CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE "/cygdrive/c/hoffman/CMakeDashboardSrc/Modules/Platform/CYGWIN-g++.cmake"
CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE "/cygdrive/c/hoffman/CMakeDashboardSrc/Modules/Platform/CYGWIN-gcc.cmake"
CMAKE_SYSTEM_INFO_FILE "/cygdrive/c/hoffman/CMakeDashboardSrc/Modules/Platform/CYGWIN.cmake"
CMAKE_SYSTEM_LOADED "1"
CMAKE_SYSTEM_NAME "CYGWIN"
CMAKE_SYSTEM_PROCESSOR "unknown"
CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED "1"
CMAKE_SYSTEM_VERSION "1.3.22(0.78/3/2)"
CMAKE_UNAME "/usr/bin/uname"
CMAKE_VERBOSE_MAKEFILE "FALSE"
CYGWIN "1"
DumpInformation_BINARY_DIR "/cygdrive/c/hoffman/CMake-gcc-dashboard/Tests/SystemInformation"
DumpInformation_CMAKE_PATH "/cygdrive/c/hoffman/CMake-gcc-dashboard/Tests/SystemInformation"
DumpInformation_SOURCE_DIR "/cygdrive/c/hoffman/CMakeDashboardSrc/Tests/SystemInformation"
EXECUTABLE_OUTPUT_PATH ""
LIBRARY_OUTPUT_PATH ""
PROJECT_BINARY_DIR "/cygdrive/c/hoffman/CMake-gcc-dashboard/Tests/SystemInformation"
PROJECT_NAME "DumpInformation"
PROJECT_SOURCE_DIR "/cygdrive/c/hoffman/CMakeDashboardSrc/Tests/SystemInformation"
UNIX "1"
WIN32 "1"

If any of them looks useful, try it on 1.6 and you will see if it works.

> ok - when do you anticipate that being ?
> I am finishing my secondment in about 1 month and will hand over my
> CMake
> work etc to someone else.  I'd like to have some kind of
> implementation
> for this particualr need before then - is there a way
> to simulate this behaviour in the mean time ?  Otherwise I will
> just hand code and maintain  the index for now.

I am affraid it will take a bit longer that 1 month.
Sorry.

You can always write an executable which will generate the list of files
and then call it from CMake. We do this kind of things in several
places.

			Andy