Using CMake, I am trying to this:
Create two Visual Studio solutions at same folder.
eg.:
root
|
|-- myproject.sln
|-- myproject_x64.sln
Generated with command line (.bat file):
cmake -G"Visual Studio 10"
del CMakeCache.txt // POG to generate win64 in the sequence "CMake ZERO_CHECK will cry"
cmake -G"Visual Studio 10 Win64"
Inside cmake file:
PROJECT(myproject)
IF(NOT "${CMAKE_CL_64}" MATCHES "0")
MESSAGE( STATUS "Generating x64 Solution...")
PROJECT(myproject_x64)
ELSE()
MESSAGE( STATUS "Generating x86 Solution...")
ENDIF()
(...)
Is it possible to do something like this ?
The CMake always generate ALL_BUILD project resulting this:
root
|-- source/header files
|-- unittest.vcxproj
|
|-- ALL_BUILD.vcxproj (used for last generated project)
|-- myproject.sln
|-- myproject_x64.sln
Is there a way to create subdirectories for (ALL_BUILD.vcxproj,INSTALL.vcxproj,PACKAGE.vcxproj, ZERO_CHECK.vcxproj) ?
eg.:
root
|-- source/header files
|-- unittest.vcxproj
|
|-- myproject.sln
|-- myproject_x64.sln
|
|---- depDir
|
| (used for myproject)
|-- ALL_BUILD.vcxproj
|-- INSTALL.vcxproj
|-- PACKAGE.vcxproj
|-- ZERO_CHECK.vcxproj
|---- depDir_x64
|
| (used for myproject_x64)
|-- ALL_BUILD.vcxproj
|-- INSTALL.vcxproj
|-- PACKAGE.vcxproj
|-- ZERO_CHECK.vcxproj
OR "preferable"
root
|-- source/header files
|-- unittest.vcxproj
|
|-- myproject.sln
|-- myproject_x64.sln
|
|-- ALL_BUILD.vcxproj (used for myproject)
|-- INSTALL.vcxproj (used for myproject)
|-- PACKAGE.vcxproj (used for myproject)
|-- ZERO_CHECK.vcxproj
|
|---- depDir_x64
|
| (used for myproject_x64)
|-- Additional CMakeLists.txt if needed.
|-- ALL_BUILD.vcxproj
|-- INSTALL.vcxproj
|-- PACKAGE.vcxproj
|-- ZERO_CHECK.vcxproj
Is it possible to do something like this ?
I found a good alternative!
I create a .bat file to generate x86, x64 folders and use a single CMakeLists file.
@echo off
echo Generating x86 Solution...
mkdir x86
cd x86
cmake -G"Visual Studio 10" "../"
cd ..
mkshortcut "../" /target:"%~dp0\x86\myproject.sln" /shortcut:"myproject.sln"
echo Generating x64 Solution...
mkdir x64
cd x64
cmake -G"Visual Studio 10 Win64" "../"
cd ..
mkshortcut "../" /target:"%~dp0\x64\myproject.sln" /shortcut:"myproject_x64.sln"
pause
Using
cd x86
and
cmake "../"
I can generate files inside x86 folder.
The result is:
root
|-- source/header files
|-- x86 <- folder
|-- x64 <- folder
|-- CMakeLists.txt
|-- myproject.sln <-shortcut to x86 .sln
|-- myproject_x64.sln <-shortcut to x64 .sln
The code to create shortcut file
mkshortcut "../" /target:"%~dp0\x86\myproject.sln" /shortcut:"myproject.sln"
Uses mkshortcut.vbs taken from giannistsakiris.com
rem This code is used to generate files shortcuts
rem eg.:
rem mkshortcut /target:"c:\myfile" /shortcut:"c:\myfileShortcut"
set WshShell = WScript.CreateObject("WScript.Shell" )
set oShellLink = WshShell.CreateShortcut(Wscript.Arguments.Named("shortcut") & ".lnk")
oShellLink.TargetPath = Wscript.Arguments.Named("target")
oShellLink.WindowStyle = 1
oShellLink.Save
To see if cmake -G"Visual Studio 10 Win64" was used:
IF(NOT "${CMAKE_CL_64}" MATCHES "0")
...
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments