[Piglit] [PATCH 1/3] tests/util: fix detection of strndup

Ian Romanick idr at freedesktop.org
Tue Sep 24 15:59:31 PDT 2013


On 09/21/2013 11:30 AM, Kenney Phillis wrote:
> There is no guarantee that cmake will blindly pass all of the defines
> to the preprocessor.

So... why doesn't "#define HAVE_STRNDUP" end up in tests/util/config.h
(like "#define HAVE_SETRLIMIT")?  I assumed (apparently incorrectly)
that would just happen when I first added this.

In other words, what did I do wrong? :)  I want to get it right next time.

> ---
>  tests/util/CMakeLists.txt |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
> index 8f1420c..1b09437 100644
> --- a/tests/util/CMakeLists.txt
> +++ b/tests/util/CMakeLists.txt
> @@ -24,6 +24,11 @@ set(UTIL_GL_SOURCES
>  	rgb9e5.c
>  	)
>  
> +if(HAVE_STRNDUP)
> +	# Make sure to pass this to the preprocessor for the compiler.
> +	add_definitions(-DHAVE_STRNDUP)
> +endif()
> +
>  if(PIGLIT_USE_WAFFLE)
>  	list(APPEND UTIL_GL_SOURCES
>  		piglit-framework-gl/piglit_gbm_framework.c
> 



More information about the Piglit mailing list