2010/10/12 Clifford Yapp <cliffy...@gmail.com>: > I'm trying to compile some C code using TRY_RUN that uses gethostname, > but in order for this code to succeed on Windows it needs "/link > ws2_32.lib" added to the compile line. I have tried putting this > string into the ARGS variable of TRY_RUN and a couple of CMake > variables, but the compile still fails and I can't see any indications > the extra link argument is being passed... am I doing something wrong?
May be you could the higher level "CheckCSourceRuns" modules which has explicit var for what you want: $ cmake --help-module CheckCSourceRuns cmake version 2.8.2 CheckCSourceRuns Check if the given C source code compiles and runs. CHECK_C_SOURCE_RUNS(<code> <var>) <code> - source code to try to compile <var> - variable to store the result (1 for success, empty for failure) The following variables may be set before calling this macro to modify the way the check is run: CMAKE_REQUIRED_FLAGS = string of compile command line flags CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) CMAKE_REQUIRED_INCLUDES = list of include directories CMAKE_REQUIRED_LIBRARIES = list of libraries to link Defined in: /usr/share/cmake-2.8/Modules/CheckCSourceRuns.cmake > Alternately, does anybody know of a pre-existing cross-platform way > to get the hostname from CMake? Don't know. I think that on many Unix "hostname" command exists. It looks like it exists on some Windows flavor too: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/hostname.mspx so may be an "execute_process" call with hostname command is portable? -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake