Hi,

On Wednesday 06 July 2016 08:43:44 you wrote:
> > #if defined(WIN32)
> > #endif
> 
> not WIN32 that way... as in add_executable( something WIN32 ... )  (or not
> WIN32)

I'm not sure I can follow. I thought you want to have compile time definitions 
like "-DSOMETHING" for GCC or "/DSOMETHING" for MSVC.
If that's what you want, then use the already defined macros for your target 
platform/OS. For Windows, the correct macro is "_WIN32" (sorry I forgot the 
underscore before).

A comprehensive list of these macros can be found here:
https://sourceforge.net/p/predef/wiki/OperatingSystems/

If that's not what you want, it would help if you could elaborate a little, or 
maybe even provide a minimum working example.

 
> > target_compile_definitions( yourTarget PRIVATE COMPILE_SHELL)
> > https://cmake.org/cmake/help/v3.4/command/target_compile_definitions.html
> > 
> > Is that what you are searching for?
> 
> it says "tems will populate theCOMPILE_DEFINITIONS
> <https://cmake.org/cmake/help/v3.4/prop_tgt/COMPILE_DEFINITIONS.html#prop_tg
> t:COMPILE_DEFINITIONS> property
> of"
> sounds like that will trigger the same CMP0065 warnings.

Did you verify that? I cannot fathom how using target_compile_definitions 
could trigger a CMP0065 warning. But maybe I'm just reading the docs 
completely wrong...
Btw. the documentation states that CMP0065 does not warn by default, but 
silently reverts to the old behavior if it's not set.


Cheers,
  Johannes


P.S.: Checking this using a minimum example does not trigger any warning for 
me on cmake 3.5.2:

--CMakeLists.txt:
cmake_minimum_required(VERSION 3.5)
project(cmake-test)
add_executable(myExe main.cpp)
target_compile_definitions(myExe PRIVATE MY_DEFINITION)
target_compile_definitions(myExe PRIVATE VERSION_STRING="0.8.15")

--main.cpp:
#include <iostream>
#ifdef _WIN32
#warning "Target platform is windows 32 or 64 bit!"
#endif
int main(int argc, char** argv)
{
#ifdef MY_DEFINITION
   std::cout << argv[0] << "compiled with MY_DEFINITION!" << std::endl;
#endif
   std::cout << argv[0] << VERSION_STRING << std::endl;
   return 0;
}

For quoted definitions, I usually use configure_file to create a platform 
header.
-- 

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

Reply via email to