Hi Brad,
On 15/05/2015 17:09, Brad King wrote:
On 05/15/2015 05:09 AM, Paul Cercueil wrote:
set(CS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/MyLib.cs
${CMAKE_CURRENT_SOURCE_DIR}/AssemblyInfo.cs)
add_custom_command(OUTPUT mylib.dll
COMMAND mcs /target:library /out:mylib.dll /debug
/keyfile:${CMAKE_CURRENT_SOURCE_DIR}/key.snk ${CS_SOURCES})
Under Windows, it will generate fine but Visual Studio will fail to
build, stating that the "C:\build\Mylib.cs" and
"C:\build\AssemblyInfo.cs" files cannot be found (source dir is
"C:\src"). This indicates that it is in fact trying to find those files
in the build directory, instead of the source directory.
CMake does not run during the build and there is no notion of
evaluating CMake variables during the build. The references
in your example code will be expanded during configuration
and the value should be generated into the .vcxproj file
without any such variable reference.
Take a look at the generated .vcxproj file. How does the
custom command appear there?
-Brad
I understand that CMake doesn't run at build time, that was a bad choice
of words.
In the generated .vcxproj I have something like that:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /target:library
/out:C:/build/mylib.dll /debug /keyfile:C:/src/key.snk C:/src/MyLib.cs
C:/build/AssemblyInfo.cs
The paths look fine, yet Visual Studio complains that it can't find
C:/build/MyLib.cs. But now I understand the reason, it's because of the
path separator. If I use a backslash '\' then csc.exe suceeds. I guess
the reason why it was looking for the source in C:\build is because
that's the current directory.
Thanks!
-Paul
--
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-developers