Re: [CMake] howto retrigger check_function_exists

2016-08-18 Thread David Cole via CMake
The code is not meant to be called. The "require += info_size" line is
to keep compiler optimizations from stripping out the info_size string
variable from the final executable.

This code is simply built, and then the resulting binary is scanned
for the string "INFO:size[],key[]" and then the string
analyzed to pull out the size

Does that make sense?


D



On Thu, Aug 18, 2016 at 3:24 PM, J Decker  wrote:
> I don't understand how this works
>
> info_size[1] will return 'N'
> how will it know it has to pass like 14 arguments to get the right
> character?  And even then the character '4' is not the value 4.
>
>
>
> - this is the code generated for check_type_size
>
> #include 
> #include 
> #include 
> #include "time.h"
>
>
> #undef KEY
> #if defined(__i386)
> # define KEY '_','_','i','3','8','6'
> #elif defined(__x86_64)
> # define KEY '_','_','x','8','6','_','6','4'
> #elif defined(__ppc__)
> # define KEY '_','_','p','p','c','_','_'
> #elif defined(__ppc64__)
> # define KEY '_','_','p','p','c','6','4','_','_'
> #endif
>
> #define SIZE (sizeof(time_t))
> char info_size[] =  {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
>   ('0' + ((SIZE / 1)%10)),
>   ('0' + ((SIZE / 1000)%10)),
>   ('0' + ((SIZE / 100)%10)),
>   ('0' + ((SIZE / 10)%10)),
>   ('0' +  (SIZE% 10)),
>   ']',
> #ifdef KEY
>   ' ','k','e','y','[', KEY, ']',
> #endif
>   '\0'};
>
> #ifdef __CLASSIC_C__
> int main(argc, argv) int argc; char *argv[];
> #else
> int main(int argc, char *argv[])
> #endif
> {
>   int require = 0;
>   require += info_size[argc];
>   (void)argv;
>   return require;
> }
>
>
>
>
>
>
> On Thu, Aug 18, 2016 at 11:50 AM, J Decker  wrote:
>>
>> I was trying to add some libraries for CMAKE_REQUIRED_LIBRARIES to be able
>> to find more symbols, but changing that didn't cause the
>> check_function-0exists to re-run; is there a shorter way to get it to re-run
>> without deleting CMakeCache.txt?
>> I'm not abject to manually editing files; I had tried to remove just the
>> cached variable reference, but that didn't help.
>>
>> Same for check_type_size() I guess
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] howto retrigger check_function_exists

2016-08-18 Thread J Decker
I don't understand how this works

info_size[1] will return 'N'
how will it know it has to pass like 14 arguments to get the right
character?  And even then the character '4' is not the value 4.



- this is the code generated for check_type_size

#include 
#include 
#include 
#include "time.h"


#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif

#define SIZE (sizeof(time_t))
char info_size[] =  {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
  ('0' + ((SIZE / 1)%10)),
  ('0' + ((SIZE / 1000)%10)),
  ('0' + ((SIZE / 100)%10)),
  ('0' + ((SIZE / 10)%10)),
  ('0' +  (SIZE% 10)),
  ']',
#ifdef KEY
  ' ','k','e','y','[', KEY, ']',
#endif
  '\0'};

#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
  int require = 0;
  require += info_size[argc];
  (void)argv;
  return require;
}






On Thu, Aug 18, 2016 at 11:50 AM, J Decker  wrote:

> I was trying to add some libraries for CMAKE_REQUIRED_LIBRARIES to be able
> to find more symbols, but changing that didn't cause the
> check_function-0exists to re-run; is there a shorter way to get it to
> re-run without deleting CMakeCache.txt?
> I'm not abject to manually editing files; I had tried to remove just the
> cached variable reference, but that didn't help.
>
> Same for check_type_size() I guess
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] howto retrigger check_function_exists

2016-08-18 Thread J Decker
I was trying to add some libraries for CMAKE_REQUIRED_LIBRARIES to be able
to find more symbols, but changing that didn't cause the
check_function-0exists to re-run; is there a shorter way to get it to
re-run without deleting CMakeCache.txt?
I'm not abject to manually editing files; I had tried to remove just the
cached variable reference, but that didn't help.

Same for check_type_size() I guess
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake