Hi cmake-users,
I have the following setup:
CMAKE: 3.0.2
Visual Studio 2010
In one of my cmake files, I’m trying to create a preprocessor definition based
on the TARGET_FILE_DIR of a different target … so I’m trying this:
target_compile_definitions(my_target_B PUBLIC
-DTARGET_A_DIR=$TARGET_FILE_DIR:my_target_A
)
When I run this for my visual studio build (2010), I get the following settings
created in the project file:
test/my_target_B.vcxproj:95:
PreprocessorDefinitionsWIN32;_WINDOWS;_DEBUG;_DEBUG;TARGET_A_DIR=Y:/work/some_lib/bld_win/src/my_target_A/Debug;CMAKE_INTDIR=Debug;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:99:
PreprocessorDefinitionsWIN32;_WINDOWS;_DEBUG;_DEBUG;TARGET_A_DIR=\Y:/work/some_lib/bld_win/src/my_target_A/Debug\;CMAKE_INTDIR=\Debug\;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:392:
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=Y:/work/some_lib/bld_win/src/my_target_A/Debug;CMAKE_INTDIR=Release;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:396:
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=\Y:/work/some_lib/bld_win/src/my_target_A/Debug\;CMAKE_INTDIR=\Release\;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:689:
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=Y:/work/some_lib/bld_win/src/my_target_A/Debug;CMAKE_INTDIR=MinSizeRel;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:693:
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=\Y:/work/some_lib/bld_win/src/my_target_A/Debug\;CMAKE_INTDIR=\MinSizeRel\;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:986:
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=Y:/work/some_lib/bld_win/src/my_target_A/Debug;CMAKE_INTDIR=RelWithDebInfo;%(PreprocessorDefinitions)/PreprocessorDefinitions
test/my_target_B.vcxproj:990:
PreprocessorDefinitionsWIN32;_WINDOWS;NDEBUG;TARGET_A_DIR=\Y:/work/some_lib/bld_win/src/my_target_A/Debug\;CMAKE_INTDIR=\RelWithDebInfo\;%(PreprocessorDefinitions)/PreprocessorDefinitions
in other words, it looks like the generator expression is only being evaluated
once (as Debug) and then used for ALL of the build configs in the visual studio
project. This isn’t exactly what I want since I need the actual output dir for
each config to be the correct one for that build type.
This same thing works fine on my linux/makefile build since the output dir is
the same for all builds.
Can anyone offer advice? Is this how the visual studio generator works or is
this possibly a bug in CMake?
Thanks,
Mike
signature.asc
Description: Message signed with OpenPGP using GPGMail
--
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