Re: Win32 Make
"Craig A. Berry" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
> On Jul 30, 2015, at 1:23 PM, Frediano Ziglio <[email protected]> wrote: > > 2015-07-30 15:26 GMT+01:00 Michael Becker <[email protected]>: >> these functions must be checked using check_symbol_exists >> >> I have changed CMakeLists.txt as follows: >> >> ============================================== >> # find functions >> set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) >> set(FUNCS _atoi64 strtok_r readpassphrase >> strlcpy strlcat basename getopt strsep gettimeofday >> nl_langinfo locale_charset setenv putenv >> getuid getpwuid getpwuid_r fstat alarm fork >> gethrtime localtime_r setitimer >> _fseeki64 _ftelli64 setrlimit >> inet_ntoa_r getipnodebyaddr getipnodebyname >> getaddrinfo inet_ntop gethostname poll socketpair >> clock_gettime fseeko pthread_cond_timedwait >> pthread_condattr_setclock _lock_file _unlock_file usleep nanosleep >> readdir_r) >> >> foreach(func ${FUNCS}) >> string(TOUPPER "HAVE_${func}" var) >> check_function_exists(${func} ${var}) >> set(HAVE_GETADDRINFO 1 CACHE INTERNAL "") >> config_write("/* Define to 1 if you have function <${func}>. */\n") >> config_write("#cmakedefine ${var} 1\n\n") >> endforeach(func) >> >> set(VSPRINTF asprintf vasprintf vsnprintf _vsnprintf snprintf _snprintf >> _vscprintf) >> >> foreach(func ${VSPRINTF}) >> string(TOUPPER "HAVE_${func}" var) >> check_symbol_exists(${func} stdio.h ${var}) >> config_write("/* Define to 1 if you have function <${func}>. */\n") >> config_write("#cmakedefine ${var} 1\n\n") >> endforeach(func) >> >> set(CMAKE_REQUIRED_LIBRARIES) >> ============================================== >> > > Change a bit to do both the tests, it continues to build on old Visual > Studio versions. > >> This works for the replacement functions but runs into an error when linking >> tdsodbc.dll because some stdio functions seem to have moved to >> legacy_stdio_definitions.lib Assuming we are still talking about the printf/scanf family of functions, according to: <https://msdn.microsoft.com/en-us/library/bb531344.aspx#BK_CRT> you should get the inline functions and no link errors if you are including the correct headers. This is the recommended solution. Only if you are unable or unwilling to include the necessary headers would you need to link against legacy_stdio_definitions.lib. I don’t know how check_function_exists in the code quoted above works. If it’s just looking for a symbol in a library, that’s not really adequate to determine what the compiler will see. >> > > Which functions? > >> How can this lib be included optional into cmake? >> > > I think just include in lib_BASE define but perhaps would be better to > avoid to use them. Depends on the functions. ________________________________________ Craig A. Berry mailto:[email protected] "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds