2009/10/8 Dixon, Shane <shane.di...@atmel.com>:
> I have two different version of my program: one that runs in simulation mode, 
> and the other that runs in "real" mode.  Right now I just select which I want 
> using an option -DEMULATION_MODE=ON or -DEMULATION_MODE=OFF.  The flag is 
> checked later and generates an installer (NSIS) that has -emul or -real at 
> the end so I know which I'm installing.
>
> My question is whether I can overload the install target to "install/real" 
> and "install/emul" with "install" just pointing to emul as a safe default.
>
> Additionally I'd like to be able to setup NSIS so that when I install, I can 
> select which version is installed at runtime there.
>
> Is all or any of this possible?

May be you can just generate 2 differents executables from the same source:
 yourprog-emul
 yourprog-real

This can be done easily using something like:

add_executable(yourprog-emul ${SOURCE})
target_link_libraries(yourprog-emul ${LIBS})
set_target_properties(yourprog-emul PROPERTIES COMPILE_FLAGS
"-DEMULATION_MODE=ON")


add_executable(yourprog-real ${SOURCE})
target_link_libraries(yourprog-real ${LIBS})
set_target_properties(yourprog-real PROPERTIES COMPILE_FLAGS
"-DEMULATION_MODE=OFF")

then you install both target using COMPONENT
install(target yourprog-real DESTINATION <dest>
         COMPONENT  RealMode)

install(target yourprog-emul DESTINATION <dest>
         COMPONENT  EmulMode)

Since you are using NSIS, you should be able to select component
from the NSIS installer at install time, see:
http://www.itk.org/Wiki/CMake:Component_Install_With_CPack

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
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

Reply via email to