INCLUDE(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES(
"#include \"wchar.h\"
static void testcb(wint_t w) { }
int main() {
wint_t w = 0;
testcb(w);
return 0;
}"
HAVE_WINT_T)
message(STATUS "HAVE_WINT_T: ${HAVE_WINT_T}")
If you start with runetype.h and start following all the headers out
and keeping track of all the symbols being #defined (plus some
googling) we can figure out that you need to include "wchar.h" as an
include file in your code in order to get "wint_t" defined and usable.
The above is the cmake code to check that case.
The above code worked on OS X 10.5.6 Intel using the Xcode 3.1.2
tooling.
Hope that helps.
---
Mike Jackson www.bluequartz.net
On Feb 16, 2009, at 10:23 PM, Aaron Turner wrote:
On Mon, Feb 16, 2009 at 5:53 PM, Michael Jackson
<[email protected]> wrote:
project(Test)
cmake_minimum_required(VERSION 2.7)
INCLUDE(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
set(CMAKE_REQUIRED_DEFINITIONS_SAVE ${CMAKE_REQUIRED_DEFINITIONS})
set(CMAKE_REQUIRED_DEFINITIONS
${CMAKE_REQUIRED_DEFINITIONS};-D__need_wint_t=1)
CHECK_TYPE_SIZE(wint_t WINT_T)
message(STATUS "Size of wint_t: ${WINT_T}")
message(STATUS "HAVE_WINT_T: ${HAVE_WINT_T}")
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS_SAVE})
Although I am not sure under what circumstances you are supposed to
define
__need_wint_t? Or if there is some other encompassing macro to
define.
Otherwise the above will find the size in bytes of wint_t.
Not sure I follow what you're trying to accomplish with the above.
Is this cmake 2.7 specific or some trick with the __need_wint_t (which
isn't used in runetype.h)?
For now, i'm just hacking around the issue with:
check_include_file("runetype.h" HAVE_RUNETYPE_H)
IF(APPLE AND HAVE_RUNETYPE_H)
# OS X has wint_t, but check_type_size won't find it
SET(HAVE_WINT_T 1)
ELSE(APPLE AND HAVE_RUNETYPE_H)
check_type_size("wint_t" HAVE_WINT_T)
ENDIF(APPLE AND HAVE_RUNTYPE_H)
Long term, I'm going to write my own version of check_symbol_exists
which uses a different test which is define/typedef agnostic.
--
Aaron Turner
http://synfin.net/
http://tcpreplay.synfin.net/ - Pcap editing and replay tools for
Unix & Windows
Those who would give up essential Liberty, to purchase a little
temporary Safety,
deserve neither Liberty nor Safety.
-- Benjamin Franklin
_______________________________________________
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
_______________________________________________
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