Last active
May 6, 2016 18:16
-
-
Save dirk-thomas/585e2fc90da969206114134b9adc6348 to your computer and use it in GitHub Desktop.
Visual Studio dependencies issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.4) | |
project(foo) | |
add_custom_target( | |
gen | |
SOURCES "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp" | |
COMMENT "Custom target" | |
) | |
add_custom_command( | |
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp" | |
COMMAND "python" "-c" "import time; print('// ' + str(time.time()))" ">" "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp" | |
COMMENT "Custom command generating the source file..." | |
VERBATIM | |
) | |
add_library( | |
lib1 SHARED | |
"${CMAKE_CURRENT_BINARY_DIR}/lib.cpp" | |
) | |
add_dependencies( | |
lib1 | |
gen | |
) | |
add_library( | |
lib2 SHARED | |
"${CMAKE_CURRENT_BINARY_DIR}/lib.cpp" | |
) | |
add_dependencies( | |
lib2 | |
gen | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment